багает изменение посещений остальное пока не делал

This commit is contained in:
antoc0der 2024-05-23 22:15:01 +04:00
parent 6ba7695422
commit a70edccc23
4 changed files with 40 additions and 5 deletions

View File

@ -18,10 +18,7 @@ namespace VeterinaryDatabaseImplement.Implements
}
public List<VisitViewModel> GetFilteredList(VisitSearchModel model)
{
if (string.IsNullOrEmpty(model.VisitName))
{
return new();
}
using var context = new VeterinaryDatabase();
return context.Visits.Include(x => x.Owner).Include(x => x.Pets).ThenInclude(x => x.Pet).Include(x => x.Doctor)
.Where(x => ((!model.Id.HasValue || x.Id == model.Id) &&

View File

@ -75,5 +75,19 @@ namespace VeterinaryRestApi.Controllers
throw;
}
}
[HttpPost]
public bool UpdateVisit(VisitBindingModel model)
{
try
{
return _visit.Update(model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Не удалось обновить лекарства");
throw;
}
}
}
}

View File

@ -206,6 +206,7 @@ namespace VeterinaryShowOwnerApp.Controllers
}
return result;
}
[HttpGet]
public IActionResult Visits()
{
if (APIOwner.Owner == null)

View File

@ -22,4 +22,27 @@
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
</div>
</form>
</form>
@section Scripts
{
<script>
function check() {
var visit = $('#visit').val();
if (visit) {
$.ajax({
method: "GET",
url: "/Home/GetVisit",
data: { visitId: visit },
success: function (result) {
$('#name').val(result.item1.visitName);
}
});
};
}
check();
$('#visit').on('change', function () {
check();
});
</script>
}