Доделал визуал крудов (наверное)
This commit is contained in:
parent
0f1757fc1d
commit
f09946ecd5
@ -557,7 +557,7 @@ View(res);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteGuidance(int guidance, int service, string text)
|
||||
public void DeleteGuidance(int guidance)
|
||||
{
|
||||
if (APIPharmacist.Pharmacist == null)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
<div class="row">
|
||||
<div class="col-4">Рекомендация:</div>
|
||||
<div class="col-8">
|
||||
<select id="guidance" name="guidance" class="form-control" asp-items="@(new SelectList(@ViewBag.Guidances, "Id", "GuidanceName"))"></select>
|
||||
<select id="guidance" name="guidance" class="form-control" asp-items="@(new SelectList(@ViewBag.Guidances, "Id", "Text"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -27,6 +27,9 @@
|
||||
<th>
|
||||
Дата
|
||||
</th>
|
||||
<th>
|
||||
Услуга
|
||||
</th>
|
||||
<th>
|
||||
Текст
|
||||
</th>
|
||||
@ -44,6 +47,10 @@
|
||||
@Html.DisplayFor(modelItem =>
|
||||
item.Date)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem =>
|
||||
item.ServiceName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem =>
|
||||
item.Text)
|
||||
|
@ -15,7 +15,12 @@
|
||||
<div class="row">
|
||||
<div class="col-4">Услуга:</div>
|
||||
<div class="col-8">
|
||||
<select id="service" name="service" class="form-control" asp-items="@(new SelectList(@ViewBag.Services,"Id", "ServiceName"))"></select>
|
||||
<select name="service" class="form-control" id="service">
|
||||
@foreach (var service in ViewBag.Services)
|
||||
{
|
||||
<option value="@service.Id" id="@service.Id">@service.ServiceName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@ -38,6 +43,7 @@ btn-primary" />
|
||||
function check() {
|
||||
|
||||
var guidance = $('#guidance').val();
|
||||
$("#service option:selected").removeAttr("selected");
|
||||
if (guidance) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
|
@ -13,7 +13,7 @@
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bgwhite border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" aspaction="Index">Магазин мороженного</a>
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" aspaction="Index">Ветклиника</a>
|
||||
<button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
|
@ -33,7 +33,8 @@ namespace VetClinicDataBaseImplement.Implements
|
||||
{
|
||||
using var context = new VetClinicDatabase();
|
||||
return context.Guidances.Include(x => x.Service).FirstOrDefault(x => (!model.Id.HasValue || model.Id == x.Id)
|
||||
&& (!model.ServiceId.HasValue || model.ServiceId == x.ServiceId) && (!model.DateFrom.HasValue || model.DateFrom <= x.Date)
|
||||
&& (!model.ServiceId.HasValue || model.ServiceId == x.ServiceId) && (string.IsNullOrEmpty(model.Text) || model.Text == x.Text)
|
||||
&& (!model.DateFrom.HasValue || model.DateFrom <= x.Date)
|
||||
&& (!model.DateTo.HasValue || model.DateTo >= x.Date))?.GetViewModel;
|
||||
}
|
||||
public GuidanceViewModel? Insert(GuidanceBindingModel model)
|
||||
@ -57,14 +58,14 @@ namespace VetClinicDataBaseImplement.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
order.Update(model);
|
||||
order.Update(context, model);
|
||||
context.SaveChanges();
|
||||
return order.GetViewModel;
|
||||
}
|
||||
public GuidanceViewModel? Delete(GuidanceBindingModel model)
|
||||
{
|
||||
using var context = new VetClinicDatabase();
|
||||
var element = context.Guidances.FirstOrDefault(rec => rec.Id ==
|
||||
var element = context.Guidances.Include(x => x.Service).FirstOrDefault(rec => rec.Id ==
|
||||
model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ namespace VetClinicDataBaseImplement.Models
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(GuidanceBindingModel? model)
|
||||
public void Update(VetClinicDatabase context, GuidanceBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -44,6 +44,8 @@ namespace VetClinicDataBaseImplement.Models
|
||||
}
|
||||
Text = model.Text;
|
||||
Date = model.Date;
|
||||
ServiceId = model.ServiceId;
|
||||
Service = context.Services.FirstOrDefault(x => x.Id == model.ServiceId);
|
||||
}
|
||||
|
||||
public GuidanceViewModel GetViewModel => new()
|
||||
|
Loading…
Reference in New Issue
Block a user