antoc0der 2024-05-01 20:22:30 +04:00
commit 1c2e4527cf
9 changed files with 54 additions and 10 deletions

View File

@ -24,7 +24,7 @@ namespace VeterinaryBusinessLogic.BusinessLogic
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
_logger.LogInformation("ReadElement. VisitName:{VisitName} Id:{ Id}", model.VisitName, model.Id);
var element = _visitStorage.GetElement(model);
if (element == null)
{
@ -37,9 +37,8 @@ namespace VeterinaryBusinessLogic.BusinessLogic
public List<VisitViewModel>? ReadList(VisitSearchModel? model)
{
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
var list = model == null ? _visitStorage.GetFullList() :
_visitStorage.GetFilteredList(model);
_logger.LogInformation("ReadList. VisitName:{VisitName} Id:{ Id}", model?.VisitName, model?.Id);
var list = model == null ? _visitStorage.GetFullList() : _visitStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");

View File

@ -221,7 +221,7 @@ namespace VeterinaryShowOwnerApp.Controllers
{
return Redirect("~/Home/Enter");
}
ViewBag.Pets = APIOwner.GetRequest<List<PetViewModel>>($"api/pet/getpet");
ViewBag.Pets = APIOwner.GetRequest<List<PetViewModel>>($"api/pet/getpet?ownerid={APIOwner.Owner.Id}");
return View();
}
@ -232,7 +232,7 @@ namespace VeterinaryShowOwnerApp.Controllers
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
if (string.IsNullOrEmpty(name))
if (string.IsNullOrEmpty(name) || dateTime < DateTime.Now)
{
throw new Exception("Ошибка в введенных данных");
}

View File

@ -3,7 +3,7 @@
}
<div class="text-center">
<h2 class="display-4">Создание животного</h2>
<h2 class="display-4">Добавление животного</h2>
</div>
<form method="post">
<div class="row">

View File

@ -0,0 +1,18 @@
@{
ViewData["Title"] = "DeleteVisit";
}
<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">
<select id="visit" name="visit" class="form-control" asp-items="@(new SelectList(@ViewBag.Visits, "Id", "VisitName"))"></select>
</div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-8"><input type="submit" value="Удалить" class="btn btn-danger" /></div>
</div>
</form>

View File

@ -6,7 +6,7 @@
</div>
<form method="post">
<div class="row">
<div class="col-4">Login:</div>
<div class="col-4">Логин:</div>
<div class="col-8"><input type="text" name="login" /></div>
</div>
<div class="row">

View File

@ -14,7 +14,7 @@
return;
}
<p>
<a asp-action="CreatePet">Создать животное</a>
<a asp-action="CreatePet">Добавить животное</a>
<a asp-action="UpdatePet">Обновить животное</a>
<a asp-action="DeletePet">Удалить животное</a>
</p>

View File

@ -0,0 +1,25 @@
@using VeterinaryContracts.ViewModels;
@{
ViewData["Title"] = "UpdateVisit";
}
<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">
<select id="visit" name="visit" class="form-control" asp-items="@(new SelectList(@ViewBag.Visits, "Id", "VisitName"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Название:</div>
<div class="col-8"><input type="text" name="name" id="name" class="form-control" /></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>

View File

@ -15,6 +15,8 @@
}
<p>
<a asp-action="CreateVisit">Создать визит</a>
<a asp-action="UpdateVisit">Изменить визит</a>
<a asp-action="DeleteeVisit">Удалить визит</a>
</p>
<table class="table">
<thead>

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - VeterinaryShowOwnerApp</title>
<title>@ViewData["Title"] - Ветеринарная клиника</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/VeterinaryShowOwnerApp.styles.css" asp-append-version="true" />