Исполнитель: сделал контроллеры
This commit is contained in:
parent
b78d7cae30
commit
2406dbd831
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
using VeterinaryContracts.BindingModels;
|
||||
using VeterinaryContracts.ViewModels;
|
||||
using VeterinaryDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace VeterinaryDatabaseImplement.Models
|
||||
{
|
||||
@ -20,10 +21,38 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
[Required]
|
||||
public string PetGender { get; private set; } = string.Empty;
|
||||
[ForeignKey("PetId")]
|
||||
public virtual List<VisitPet> VisitPets { get; set; } = new();
|
||||
public virtual List<VisitPet> Visits { get; set; } = new();
|
||||
[ForeignKey("PetId")]
|
||||
public virtual List<PurchasePet> PurchasePets { get; set; } = new();
|
||||
public static Pet? Create(PetBindingModel model)
|
||||
public virtual List<PurchasePet> Purchases { get; set; } = new();
|
||||
public Dictionary<int, IVisitModel>? _visitPets = null;
|
||||
[NotMapped]
|
||||
public Dictionary<int, IVisitModel> VisitPets
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_visitPets == null)
|
||||
{
|
||||
_visitPets = Visits.ToDictionary(recPC => recPC.VisitId, recPC =>
|
||||
recPC.Visit as IVisitModel);
|
||||
}
|
||||
return _visitPets;
|
||||
}
|
||||
}
|
||||
public Dictionary<int, IPurchaseModel>? _purchasePets = null;
|
||||
[NotMapped]
|
||||
public Dictionary<int, IPurchaseModel> PurchasePets
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_purchasePets == null)
|
||||
{
|
||||
_purchasePets = Purchases.ToDictionary(recPC => recPC.PurchaseId, recPC =>
|
||||
recPC.Purchase as IPurchaseModel);
|
||||
}
|
||||
return _purchasePets;
|
||||
}
|
||||
}
|
||||
public static Pet? Create(VeterinaryDatabase context, PetBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -35,18 +64,15 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
PetName = model.PetName,
|
||||
PetType = model.PetType,
|
||||
PetBreed = model.PetBreed,
|
||||
PetGender = model.PetGender
|
||||
};
|
||||
}
|
||||
public static Pet Create(PetViewModel model)
|
||||
{
|
||||
return new Pet
|
||||
{
|
||||
Id = model.Id,
|
||||
PetName = model.PetName,
|
||||
PetType = model.PetType,
|
||||
PetBreed = model.PetBreed,
|
||||
PetGender = model.PetGender
|
||||
PetGender = model.PetGender,
|
||||
Visits = model.VisitPets.Select(x => new VisitPet
|
||||
{
|
||||
Visit = context.Visits.First(y => y.Id == x.Key)
|
||||
}).ToList(),
|
||||
Purchases = model.PurchasePets.Select(x => new PurchasePet
|
||||
{
|
||||
Purchase = context.Purchases.First(y => y.Id == x.Key)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
public void Update(PetBindingModel model)
|
||||
@ -68,5 +94,31 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
PetBreed = PetBreed,
|
||||
PetGender = PetGender
|
||||
};
|
||||
public void UpdateVisits(VeterinaryDatabase context, PetBindingModel model)
|
||||
{
|
||||
var visitPets = context.VisitPets.Where(rec => rec.PetId == model.Id).ToList();
|
||||
if (visitPets != null)
|
||||
{
|
||||
context.VisitPets.RemoveRange(visitPets.Where(rec => !model.VisitPets.ContainsKey(rec.VisitId)));
|
||||
context.SaveChanges();
|
||||
foreach (var visit in visitPets)
|
||||
{
|
||||
model.VisitPets.Remove(visit.VisitId);
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
var pet = context.Pets.First(x => x.Id == Id);
|
||||
foreach (var pc in model.VisitPets)
|
||||
{
|
||||
context.VisitPets.Add(new VisitPet
|
||||
{
|
||||
Pet = pet,
|
||||
Visit = context.Visits.First(x => x.Id == pc.Key),
|
||||
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_visitPets = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using VeterinaryContracts.BindingModels;
|
||||
using VeterinaryContracts.BusinessLogicContracts;
|
||||
using VeterinaryContracts.SearchModels;
|
||||
using VeterinaryContracts.ViewModels;
|
||||
using VeterinaryDatabaseImplement.Models;
|
||||
|
||||
namespace VeterinaryRestApi.Controllers
|
||||
{
|
||||
@ -18,22 +19,6 @@ namespace VeterinaryRestApi.Controllers
|
||||
_pet = pet;
|
||||
}
|
||||
[HttpGet]
|
||||
public Tuple<PetViewModel, List<string>>? GetPet(int petId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var elem = _pet.ReadElement(new PetSearchModel { Id = petId });
|
||||
if (elem == null)
|
||||
return null;
|
||||
return Tuple.Create(elem, elem.VisitPets.Select(x => x.Value.Name).ToList());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения услуги по id={Id}", petId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public List<PetViewModel> GetPets(int ownerId)
|
||||
{
|
||||
try
|
||||
@ -42,7 +27,7 @@ namespace VeterinaryRestApi.Controllers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка услуг");
|
||||
_logger.LogError(ex, "Ошибка получения списка животных");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -55,7 +40,7 @@ namespace VeterinaryRestApi.Controllers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Не удалось создать услугу");
|
||||
_logger.LogError(ex, "Не удалось создать животного");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -65,12 +50,11 @@ namespace VeterinaryRestApi.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
model.Pets = null!;
|
||||
return _pet.Update(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Не удалось обновить услугу");
|
||||
_logger.LogError(ex, "Не удалось обновить животное");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -84,7 +68,7 @@ namespace VeterinaryRestApi.Controllers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления услуги");
|
||||
_logger.LogError(ex, "Ошибка удаления животного");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using VeterinaryContracts.BindingModels;
|
||||
using VeterinaryContracts.BusinessLogicContracts;
|
||||
using VeterinaryContracts.SearchModels;
|
||||
using VeterinaryContracts.ViewModels;
|
||||
|
||||
namespace VeterinaryRestApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class PurchaseController : Controller
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPurchaseLogic _purchase;
|
||||
public PurchaseController(ILogger<PurchaseController> logger, IPurchaseLogic purchase)
|
||||
{
|
||||
_logger = logger;
|
||||
_purchase = purchase;
|
||||
}
|
||||
[HttpGet]
|
||||
public Tuple<PurchaseViewModel, List<string>>? GetPurchase(int purchaseId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var elem = _purchase.ReadElement(new PurchaseSearchModel { Id = purchaseId });
|
||||
if (elem == null)
|
||||
return null;
|
||||
return Tuple.Create(elem, elem.PurchasePet.Select(x => x.Value.PetName).ToList());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения покупки по id={Id}", purchaseId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public List<PurchaseViewModel> GetPurchases()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _purchase.ReadList(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка покупок");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public bool CreatePurchase(PurchaseBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _purchase.CreatePurchase(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Не удалось создать покупку");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using VeterinaryContracts.BindingModels;
|
||||
using VeterinaryContracts.BusinessLogicContracts;
|
||||
using VeterinaryContracts.SearchModels;
|
||||
using VeterinaryContracts.ViewModels;
|
||||
using VeterinaryDatabaseImplement.Models;
|
||||
|
||||
namespace VeterinaryRestApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class VisitController : Controller
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IVisitLogic _visit;
|
||||
public VisitController(ILogger<VisitController> logger, IVisitLogic visit)
|
||||
{
|
||||
_logger = logger;
|
||||
_visit = visit;
|
||||
}
|
||||
[HttpGet]
|
||||
public Tuple<VisitViewModel, List<string>>? GetVisit(int visitId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var elem = _visit.ReadElement(new VisitSearchModel { Id = visitId });
|
||||
if (elem == null)
|
||||
return null;
|
||||
return Tuple.Create(elem, elem.VisitPet.Select(x => x.Value.PetName).ToList());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения визита по id={Id}", visitId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public List<VisitViewModel> GetVisits(int ownerId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _visit.ReadList(new VisitSearchModel { OwnerId = ownerId });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка визитов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public bool CreateVisit(VisitBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _visit.CreateVisit(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Не удалось создать визит");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,10 @@ using VeterinaryContracts.BindingModels;
|
||||
using VeterinaryContracts.ViewModels;
|
||||
using VeterinaryShowOwnerApp.Models;
|
||||
using VeterinaryShowOwnerApp;
|
||||
|
||||
using System.Reflection;
|
||||
using VeterinaryDataModels.Models;
|
||||
using VeterinaryContracts.SearchModels;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace VeterinaryShowOwnerApp.Controllers
|
||||
{
|
||||
@ -124,7 +127,7 @@ namespace VeterinaryShowOwnerApp.Controllers
|
||||
}
|
||||
if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(type) || string.IsNullOrEmpty(breed) || string.IsNullOrEmpty(gender))
|
||||
{
|
||||
throw new Exception("Ошибка введённых данных");
|
||||
throw new Exception("Ошибка в введённых данных");
|
||||
}
|
||||
APIOwner.PostRequest("api/pet/createpet", new PetBindingModel
|
||||
{
|
||||
@ -190,7 +193,7 @@ namespace VeterinaryShowOwnerApp.Controllers
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpGet]
|
||||
public Tuple<PetViewModel, string>? GetPet(int petId)
|
||||
public Tuple<PetViewModel, List<string>>? GetPet(int petId)
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
@ -201,16 +204,240 @@ namespace VeterinaryShowOwnerApp.Controllers
|
||||
{
|
||||
return default;
|
||||
}
|
||||
string table = "";
|
||||
result.Item1.MedicineAnimals.Clear();
|
||||
for (int i = 0; i < result.Item2.Count; i++)
|
||||
return result;
|
||||
}
|
||||
public IActionResult Visits()
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
var animal = result.Item2[i];
|
||||
table += "<tr>";
|
||||
table += $"<td>{animal}</td>";
|
||||
table += "</tr>";
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return Tuple.Create(result.Item1, table);
|
||||
return View(APIOwner.GetRequest<List<VisitViewModel>>($"api/visit/getvisit?ownerid={APIOwner.Owner.Id}"));
|
||||
|
||||
}
|
||||
public IActionResult CreateVisit()
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Pets = APIOwner.GetRequest<List<PetViewModel>>($"api/pet/getpet");
|
||||
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreateVisit(string name, List<int> pets, DateTime dateTime)
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new Exception("Ошибка в введенных данных");
|
||||
}
|
||||
Dictionary<int, IPetModel> a = new Dictionary<int, IPetModel>();
|
||||
foreach (int pet in pets)
|
||||
{
|
||||
a.Add(pet, new PetSearchModel { Id = pet } as IPetModel);
|
||||
}
|
||||
APIOwner.PostRequest("api/visit/createvisit", new VisitBindingModel
|
||||
{
|
||||
VisitName = name,
|
||||
VisitPet = a,
|
||||
DateVisit = dateTime,
|
||||
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
public IActionResult DeleteVisit()
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Visits = APIOwner.GetRequest<List<VisitViewModel>>($"api/visit/getvisit?ownerid={APIOwner.Owner.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteDrug(int visit)
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
APIOwner.PostRequest("api/visit/deletevisit", new VisitBindingModel
|
||||
{
|
||||
Id = visit
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
public IActionResult UpdateVisit()
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Visits = APIOwner.GetRequest<List<VisitViewModel>>($"api/visit/getvisits?ownerid={APIOwner.Owner.Id}");
|
||||
ViewBag.Pets = APIOwner.GetRequest<List<PetViewModel>>($"api/pet/getpet");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateVisit(int visit, string name, List<int> pets)
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new Exception("Ошибка в введенных данных");
|
||||
}
|
||||
Dictionary<int, IPetModel> a = new Dictionary<int, IPetModel>();
|
||||
foreach (int pet in pets)
|
||||
{
|
||||
a.Add(pet, new PetSearchModel { Id = pet } as IPetModel);
|
||||
}
|
||||
APIOwner.PostRequest("api/visit/updatevisit", new VisitBindingModel
|
||||
{
|
||||
Id = visit,
|
||||
VisitName = name,
|
||||
VisitPet = a
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpGet]
|
||||
public Tuple<VisitViewModel, List<string>>? GetVisit(int visitId)
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
var result = APIOwner.GetRequest<Tuple<VisitViewModel, List<string>>>($"api/visit/getvisit?visitid={visitId}");
|
||||
if (result == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public IActionResult Purchase()
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIOwner.GetRequest<List<PurchaseViewModel>>($"api/purchase/getpyrchase?ownerid={APIOwner.Owner.Id}"));
|
||||
|
||||
}
|
||||
public IActionResult CreatePurchase()
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Pets = APIOwner.GetRequest<List<PetViewModel>>($"api/pet/getpets");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreatePurchase(int drug, List<int> pets, int count)
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
if (count <= 0)
|
||||
{
|
||||
throw new Exception("Количество должно быть выше 0");
|
||||
}
|
||||
Dictionary<int, IPetModel> a = new Dictionary<int, IPetModel>();
|
||||
foreach (int pet in pets)
|
||||
{
|
||||
a.Add(pet, new PetSearchModel { Id = pet } as IPetModel);
|
||||
}
|
||||
APIOwner.PostRequest("api/purchase/createpurchase", new PurchaseBindingModel
|
||||
{
|
||||
OwnerId = APIOwner.Owner.Id,
|
||||
DrugId = drug,
|
||||
PurchasePet = a,
|
||||
Sum = Calc(count, drug)
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpPost]
|
||||
public double Calc(int count, int drug)
|
||||
{
|
||||
var dru = APIOwner.GetRequest<DrugViewModel>($"api/main/getdrug?drugId={drug}"
|
||||
);
|
||||
return count * (dru?.Price ?? 1);
|
||||
}
|
||||
public IActionResult DeletePurchase()
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Purchases = APIOwner.GetRequest<List<PurchaseViewModel>>($"api/purchase/getpurchases?ownerid={APIOwner.Owner.Id}");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void DeletePurchase(int purchase)
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
APIOwner.PostRequest("api/purchase/deletepurchase", new PurchaseBindingModel
|
||||
{
|
||||
Id = purchase
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
public IActionResult UpdateService()
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Purchases = APIOwner.GetRequest<List<PurchaseViewModel>>($"api/purchase/getpurchases?ownerid={APIOwner.Owner.Id}");
|
||||
ViewBag.Pets = APIOwner.GetRequest<List<PetViewModel>>($"api/pet/getpets");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void UpdatePurchase(int drug, List<int> pets, int count)
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
Dictionary<int, IPetModel> a = new Dictionary<int, IPetModel>();
|
||||
foreach (int pet in pets)
|
||||
{
|
||||
a.Add(pet, new PetSearchModel { Id = pet } as IPetModel);
|
||||
}
|
||||
APIOwner.PostRequest("api/purchase/updatepurchase", new PurchaseBindingModel
|
||||
{
|
||||
OwnerId = APIOwner.Owner.Id,
|
||||
DrugId = drug,
|
||||
PurchasePet = a,
|
||||
Sum = Calc(count, drug)
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpGet]
|
||||
public Tuple<PurchaseViewModel, List<string>>? GetPurchase(int purchaseId)
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
var result = APIOwner.GetRequest<Tuple<PurchaseViewModel, List<string>>>($"api/purchase/getpurchase?purchaseid={purchaseId}");
|
||||
if (result == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="Views\Home\CreatePet.cshtml" />
|
||||
<Content Remove="Views\Home\CreateVisit.cshtml" />
|
||||
<Content Remove="Views\Home\DeletePet.cshtml" />
|
||||
<Content Remove="Views\Home\UpdatePet.cshtml" />
|
||||
</ItemGroup>
|
||||
@ -26,4 +27,8 @@
|
||||
<ProjectReference Include="..\VeterinaryContracts\VeterinaryContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="Views\Home\CreateVisit.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -0,0 +1,6 @@
|
||||
namespace VeterinaryShowOwnerApp.Views.Home
|
||||
{
|
||||
public class CreatePurchase
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
@{
|
||||
ViewData["Title"] = "CreateVisit";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание посещения</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Название:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="name" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Дата:</div>
|
||||
<div class="col-8">
|
||||
<input type="datetime" id="datetime" name="date" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Животные:</div>
|
||||
<div class="col-8">
|
||||
<select name="pets" class="form-control" multiple size="6" id="pets">
|
||||
@foreach (var pet in ViewBag.Pets)
|
||||
{
|
||||
<option value="@pet.Id">@pet.PetName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Создать" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
Loading…
Reference in New Issue
Block a user