визиты фул. приступаю к лекарствам
This commit is contained in:
parent
a70edccc23
commit
69cdb744c9
@ -60,7 +60,22 @@ namespace VeterinaryBusinessLogic.BusinessLogic
|
||||
}
|
||||
public bool Update(VisitBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.VisitName))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия визита", nameof(model.VisitName));
|
||||
}
|
||||
var element = _visitStorage.GetElement(new VisitSearchModel
|
||||
{
|
||||
VisitName = model.VisitName
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Визит с таким названием уже есть");
|
||||
}
|
||||
if (_visitStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
|
@ -287,7 +287,7 @@ namespace VeterinaryShowOwnerApp.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateVisit(int visit, string name, List<int> pets)
|
||||
public void UpdateVisit(int visit, string name)
|
||||
{
|
||||
if (APIOwner.Owner == null)
|
||||
{
|
||||
@ -297,18 +297,13 @@ namespace VeterinaryShowOwnerApp.Controllers
|
||||
{
|
||||
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
|
||||
OwnerId = APIOwner.Owner.Id,
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
Response.Redirect("Visits");
|
||||
}
|
||||
[HttpGet]
|
||||
public Tuple<VisitViewModel, List<string>>? GetVisit(int visitId)
|
||||
|
Loading…
Reference in New Issue
Block a user