This commit is contained in:
kagbie3nn@mail.ru 2024-05-31 17:27:40 +04:00
parent e19ee5e3f4
commit d98e21109d
3 changed files with 23 additions and 5 deletions

View File

@ -162,7 +162,7 @@ namespace ZooClientApp.Controllers
{
return Redirect("~/Home/Enter");
}
ViewBag.Preserves = APIClient.GetRequest<List<PreserveViewModel>>($"api/preserve/getpreserves?clientid={APIClient.Client.Id}");
ViewBag.Preserves = APIClient.GetRequest<List<PreserveViewModel>>($"api/preserve/getpreserves");
return View();
}
[HttpPost]

View File

@ -23,10 +23,6 @@ namespace ZooDataBaseImplement.Implements
public List<PreserveViewModel> GetFilteredList(PreserveSearchModel
model)
{
if (string.IsNullOrEmpty(model.PreserveName))
{
return new();
}
using var context = new ZooDatabase();
return context.Preserves.Where(x => x.EmployeeId == model.EmployeeId)
.Where(x => String.IsNullOrEmpty(model.PreserveName) || x.PreserveName.Contains(model.PreserveName))

View File

@ -0,0 +1,22 @@
@{
ViewData["Title"] = "UpdatePreserve";
}
<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="pet" name="name" class="form-control" asp-items="@(new SelectList(@ViewBag.Preserves, "Id", "PreserveName"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Возраст:</div>
<div class="col-8"><input type="text" name="price" /></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>