поручитель. теперь создаются медикаменты нормально
This commit is contained in:
parent
1e139daa5f
commit
05c9929870
@ -25,13 +25,10 @@ namespace VeterinaryDatabaseImplement.Implements
|
||||
}
|
||||
public List<MedicationViewModel> GetFilteredList(MedicationSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.MedicationName))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
using var context = new VeterinaryDatabase();
|
||||
return context.Medications
|
||||
.Where(x => x.MedicationName.Contains(model.MedicationName))
|
||||
return context.Medications.Where(x=>x.DoctorId == model.DoctorId)
|
||||
.Where(x => String.IsNullOrEmpty(model.MedicationName) || x.MedicationName.Contains(model.MedicationName))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
@ -13,9 +13,6 @@
|
||||
<div class="col-8">
|
||||
<select id="medication" name="medication" class="form-control" asp-items="@(new SelectList(@ViewBag.Medications, "Id", "MedicationName"))"></select>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<select id="animal" name="animal" class="form-control" asp-items="@(new SelectList(@ViewBag.Animals, "Id", "AnimalName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Название:</div>
|
||||
@ -26,17 +23,7 @@
|
||||
<div class="col-8"><input type="number" id="price" name="price" class="form-control" /></div>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Животное
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="table-elements">
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
||||
@ -56,7 +43,6 @@
|
||||
success: function (result) {
|
||||
$('#name').val(result.item1.medicationName);
|
||||
$('#price').val(result.item1.price);
|
||||
$('#table-elements').html(result.item2);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user