пожалуй ошибся не я
This commit is contained in:
parent
f1f97916a8
commit
47ab8f7e72
@ -93,12 +93,12 @@ namespace VeterinaryBusinessLogic.BusinessLogic
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия визита", nameof(model.VisitName));
|
||||
}
|
||||
if (model.DateVisit != null)
|
||||
if (model.DateVisit == null)
|
||||
{
|
||||
throw new ArgumentNullException("Нет времени визита",
|
||||
nameof(model.DateVisit));
|
||||
}
|
||||
if (model.DateVisit >= DateTime.Now)
|
||||
if (model.DateVisit <= DateTime.Now)
|
||||
{
|
||||
throw new ArgumentNullException("Дата посещения не должна быть в прошлом", nameof(model.DateVisit));
|
||||
}
|
||||
|
@ -19,13 +19,10 @@ namespace VeterinaryDatabaseImplement.Implements
|
||||
}
|
||||
public List<PetViewModel> GetFilteredList(PetSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.PetName))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
using var context = new VeterinaryDatabase();
|
||||
return context.Pets.Where(x => x.OwnerId == model.OwnerId)
|
||||
.Where(x => x.PetName.Contains(model.PetName))
|
||||
.Where(x => String.IsNullOrEmpty(model.PetName) || x.PetName.Contains(model.PetName))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -103,8 +100,7 @@ namespace VeterinaryDatabaseImplement.Implements
|
||||
public PetViewModel? Update(PetBindingModel model)
|
||||
{
|
||||
using var context = new VeterinaryDatabase();
|
||||
var component = context.Pets.FirstOrDefault(x => x.Id ==
|
||||
model.Id);
|
||||
var component = context.Pets.FirstOrDefault(x => x.Id ==model.Id);
|
||||
if (component == null)
|
||||
{
|
||||
return null;
|
||||
|
@ -15,7 +15,7 @@
|
||||
<div class="row">
|
||||
<div class="col-4">Дата:</div>
|
||||
<div class="col-8">
|
||||
<input type="datetime" id="datetime" name="date" />
|
||||
<input type="datetime-local" id="datetime" name="datetime" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -29,6 +29,11 @@
|
||||
<div class="col-8"><input type="text" id="gender" name="gender" 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>
|
||||
|
||||
@section Scripts
|
||||
|
Loading…
Reference in New Issue
Block a user