fix
This commit is contained in:
parent
c8de74e931
commit
7a37e5d985
@ -25,26 +25,29 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
@section Scripts
|
||||||
$('#dish').on('change', function () {
|
{
|
||||||
check();
|
<script>
|
||||||
});
|
$('#dish').on('change', function () {
|
||||||
$('#count').on('change', function () {
|
check();
|
||||||
check();
|
});
|
||||||
});
|
$('#count').on('change', function () {
|
||||||
|
check();
|
||||||
|
});
|
||||||
|
|
||||||
function check() {
|
function check() {
|
||||||
var count = $('#count').val();
|
var count = $('#count').val();
|
||||||
var dish = $('#dish').val();
|
var dish = $('#dish').val();
|
||||||
if (count && dish) {
|
if (count && dish) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/Home/Calc",
|
url: "/Home/Calc",
|
||||||
data: { count: count, dish: dish },
|
data: { count: count, dish: dish },
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
$("#sum").val(result);
|
$("#sum").val(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
}
|
@ -23,15 +23,21 @@ namespace FoodOrdersDatabaseImplement.Implements
|
|||||||
|
|
||||||
public ClientViewModel? GetElement(ClientSearchModel model)
|
public ClientViewModel? GetElement(ClientSearchModel model)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
using var context = new FoodOrdersDatabase();
|
using var context = new FoodOrdersDatabase();
|
||||||
return context.Clients
|
if (model.Id.HasValue)
|
||||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Email) && x.Email == model.Email) ||
|
return context.Clients
|
||||||
(model.Id.HasValue && x.Id == model.Id))
|
.FirstOrDefault(x => x.Id == model.Id)?
|
||||||
?.GetViewModel;
|
.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)
|
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
|
||||||
|
@ -21,6 +21,10 @@ namespace FoodOrdersDatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
|
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.ClientId.HasValue)
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
using var context = new FoodOrdersDatabase();
|
using var context = new FoodOrdersDatabase();
|
||||||
if (model.ClientId.HasValue)
|
if (model.ClientId.HasValue)
|
||||||
{
|
{
|
||||||
@ -31,7 +35,7 @@ namespace FoodOrdersDatabaseImplement.Implements
|
|||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
else if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||||
{
|
{
|
||||||
return context.Orders
|
return context.Orders
|
||||||
.Include(x => x.Dish)
|
.Include(x => x.Dish)
|
||||||
|
Loading…
Reference in New Issue
Block a user