fix
This commit is contained in:
parent
c8de74e931
commit
7a37e5d985
@ -25,7 +25,9 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
@section Scripts
|
||||
{
|
||||
<script>
|
||||
$('#dish').on('change', function () {
|
||||
check();
|
||||
});
|
||||
@ -47,4 +49,5 @@
|
||||
});
|
||||
};
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
}
|
@ -23,15 +23,21 @@ namespace FoodOrdersDatabaseImplement.Implements
|
||||
|
||||
public ClientViewModel? GetElement(ClientSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new FoodOrdersDatabase();
|
||||
if (model.Id.HasValue)
|
||||
return context.Clients
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Email) && x.Email == model.Email) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
.FirstOrDefault(x => x.Id == model.Id)?
|
||||
.GetViewModel;
|
||||
if (!string.IsNullOrEmpty(model.Email) && !string.IsNullOrEmpty(model.Password))
|
||||
return context.Clients
|
||||
.FirstOrDefault(x => x.Email
|
||||
.Equals(model.Email) && x.Password
|
||||
.Equals(model.Password))?
|
||||
.GetViewModel;
|
||||
if (!string.IsNullOrEmpty(model.Email))
|
||||
return context.Clients
|
||||
.FirstOrDefault(x => x.Email.Equals(model.Email))?.GetViewModel;
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
|
||||
|
@ -21,6 +21,10 @@ namespace FoodOrdersDatabaseImplement.Implements
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.ClientId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new FoodOrdersDatabase();
|
||||
if (model.ClientId.HasValue)
|
||||
{
|
||||
@ -31,7 +35,7 @@ namespace FoodOrdersDatabaseImplement.Implements
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
else if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Dish)
|
||||
|
Loading…
Reference in New Issue
Block a user