fix
This commit is contained in:
parent
36233b487a
commit
e15ecf3e31
@ -163,7 +163,9 @@ namespace CanteenBusinessLogic.BusinessLogics
|
|||||||
LunchName = _lunch.LunchName,
|
LunchName = _lunch.LunchName,
|
||||||
Sum = _lunch.Sum,
|
Sum = _lunch.Sum,
|
||||||
VisitorId = _lunch.VisitorId,
|
VisitorId = _lunch.VisitorId,
|
||||||
LunchOrders = _lunch.LunchOrders
|
DateImplement = _lunch.DateImplement,
|
||||||
|
LunchOrders = _lunch.LunchOrders,
|
||||||
|
Status = _lunch.Status,
|
||||||
|
|
||||||
}) == null)
|
}) == null)
|
||||||
{
|
{
|
||||||
|
@ -109,7 +109,8 @@ namespace CanteenBusinessLogic.BusinessLogics
|
|||||||
Id = _order.Id,
|
Id = _order.Id,
|
||||||
Description = _order.Description,
|
Description = _order.Description,
|
||||||
VisitorId = _order.VisitorId,
|
VisitorId = _order.VisitorId,
|
||||||
OrderCooks = _order.OrderCooks
|
OrderCooks = _order.OrderCooks,
|
||||||
|
OrderTablewares = _order.OrderTablewares
|
||||||
|
|
||||||
}) == null)
|
}) == null)
|
||||||
{
|
{
|
||||||
@ -139,7 +140,8 @@ namespace CanteenBusinessLogic.BusinessLogics
|
|||||||
Id = _order.Id,
|
Id = _order.Id,
|
||||||
Description = _order.Description,
|
Description = _order.Description,
|
||||||
VisitorId = _order.VisitorId,
|
VisitorId = _order.VisitorId,
|
||||||
OrderTablewares = _order.OrderTablewares
|
OrderTablewares = _order.OrderTablewares,
|
||||||
|
OrderCooks = _order.OrderCooks
|
||||||
|
|
||||||
}) == null)
|
}) == null)
|
||||||
{
|
{
|
||||||
|
@ -93,8 +93,8 @@ namespace CanteenBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
var lunches = lunchStorage.GetFilteredList(new LunchSearchModel
|
var lunches = lunchStorage.GetFilteredList(new LunchSearchModel
|
||||||
{
|
{
|
||||||
DateFrom = model.DateBefore,
|
DateFrom = model.DateAfter,
|
||||||
DateTo = model.DateAfter,
|
DateTo = model.DateBefore,
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var cook in cooks)
|
foreach (var cook in cooks)
|
||||||
@ -119,7 +119,7 @@ namespace CanteenBusinessLogic.BusinessLogics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list.Add(record);
|
if (record.Lunches.Count > 0) list.Add(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -34,7 +34,7 @@ namespace CanteenDatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<CookViewModel> GetFilteredList(CookSearchModel model)
|
public List<CookViewModel> GetFilteredList(CookSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue && !model.OrderId.HasValue && !model.ManagerId.HasValue)
|
if (!model.OrderId.HasValue && !model.ManagerId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
@ -47,7 +47,6 @@ namespace CanteenDatabaseImplement.Implements
|
|||||||
.Include(x => x.Orders)
|
.Include(x => x.Orders)
|
||||||
.ThenInclude(x => x.Order)
|
.ThenInclude(x => x.Order)
|
||||||
.Where(x =>
|
.Where(x =>
|
||||||
(model.Id.HasValue && x.Id == model.Id) ||
|
|
||||||
(model.ManagerId.HasValue && model.ManagerId == x.ManagerId) ||
|
(model.ManagerId.HasValue && model.ManagerId == x.ManagerId) ||
|
||||||
(model.OrderId.HasValue && x.Orders.Find(x => x.CookId == model.OrderId) != null))
|
(model.OrderId.HasValue && x.Orders.Find(x => x.CookId == model.OrderId) != null))
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
|
@ -63,7 +63,6 @@ namespace CanteenDatabaseImplement.Implements
|
|||||||
.Include(x => x.Tablewares)
|
.Include(x => x.Tablewares)
|
||||||
.ThenInclude(x => x.Tableware)
|
.ThenInclude(x => x.Tableware)
|
||||||
.Where(x =>
|
.Where(x =>
|
||||||
(model.Id.HasValue && x.Id == model.Id) ||
|
|
||||||
(model.VisitorId.HasValue && model.VisitorId == x.VisitorId))
|
(model.VisitorId.HasValue && model.VisitorId == x.VisitorId))
|
||||||
.Select(x => x.GetViewModel).ToList();
|
.Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,7 @@ namespace CanteenDatabaseImplement.Implements
|
|||||||
return context.Products
|
return context.Products
|
||||||
.Include(x => x.Cooks)
|
.Include(x => x.Cooks)
|
||||||
.ThenInclude(x => x.Cook)
|
.ThenInclude(x => x.Cook)
|
||||||
.Where(x => (model.Id.HasValue && x.Id == model.Id) ||
|
.Where(x => (model.ManagerId.HasValue && model.ManagerId == x.ManagerId))
|
||||||
(model.ManagerId.HasValue && model.ManagerId == x.ManagerId))
|
|
||||||
.Select(x => x.GetViewModel).ToList();
|
.Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ namespace CanteenDatabaseImplement.Implements
|
|||||||
using var context = new CanteenDatabase();
|
using var context = new CanteenDatabase();
|
||||||
|
|
||||||
return context.Tablewares
|
return context.Tablewares
|
||||||
.Where(x => (model.Id.HasValue && x.Id == model.Id) || (model.VisitorId.HasValue && model.VisitorId == x.VisitorId))
|
.Where(x => (model.VisitorId.HasValue && model.VisitorId == x.VisitorId))
|
||||||
.Select(x => x.GetViewModel).ToList();
|
.Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,15 +13,15 @@
|
|||||||
<h4>Pdf</h4>
|
<h4>Pdf</h4>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@Html.LabelFor(m => m.DateBefore, "От")
|
@Html.LabelFor(m => m.DateAfter, "От")
|
||||||
@Html.TextBoxFor(m => m.DateBefore, new { type = "date", @class = "form-control" })
|
@Html.TextBoxFor(m => m.DateAfter, new { type = "date", @class = "form-control" })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@Html.LabelFor(m => m.DateAfter, "До")
|
@Html.LabelFor(m => m.DateBefore, "До")
|
||||||
@Html.TextBoxFor(m => m.DateAfter, new { type = "date", @class = "form-control" })
|
@Html.TextBoxFor(m => m.DateBefore, new { type = "date", @class = "form-control" })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -558,7 +558,16 @@ namespace CanteenRestApi.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_lunch.Update(model);
|
var lunch = _lunch.ReadElement(new LunchSearchModel { Id = model.Id });
|
||||||
|
_lunch.Update(new LunchBindingModel
|
||||||
|
{
|
||||||
|
Id = lunch.Id,
|
||||||
|
LunchName = lunch.LunchName,
|
||||||
|
Sum = lunch.Sum,
|
||||||
|
DateImplement = lunch.DateImplement,
|
||||||
|
DateCreate = lunch.DateCreate,
|
||||||
|
VisitorId = lunch.VisitorId,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -597,7 +606,13 @@ namespace CanteenRestApi.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_lunch.Finish(model);
|
var lunch = _lunch.ReadElement(new LunchSearchModel { Id = model.Id });
|
||||||
|
_lunch.Finish(new LunchBindingModel
|
||||||
|
{
|
||||||
|
Id = lunch.Id,
|
||||||
|
LunchName = lunch.LunchName,
|
||||||
|
Sum = lunch.Sum
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -442,7 +442,7 @@ namespace CanteenVisitorApp.Controllers
|
|||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
VisitorId = APIClient.Visitor.Id,
|
VisitorId = APIClient.Visitor.Id,
|
||||||
LunchName = name
|
LunchName = name,
|
||||||
});
|
});
|
||||||
Response.Redirect("Lunches");
|
Response.Redirect("Lunches");
|
||||||
}
|
}
|
||||||
@ -493,8 +493,15 @@ namespace CanteenVisitorApp.Controllers
|
|||||||
{
|
{
|
||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
ViewBag.LunchList = APIClient.GetRequest<List<LunchViewModel>>($"api/main/getlunchlist?visitorId={APIClient.Visitor.Id}");
|
// Получение данных и сохранение их в переменные
|
||||||
ViewBag.OrderList = APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorderlist?visitorId={APIClient.Visitor.Id}");
|
var lunchList = APIClient.GetRequest<List<LunchViewModel>>($"api/main/getlunchlist?visitorId={APIClient.Visitor.Id}");
|
||||||
|
var orderList = APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorderlist?visitorId={APIClient.Visitor.Id}");
|
||||||
|
|
||||||
|
// Сохранение данных в ViewBag
|
||||||
|
ViewBag.LunchList = lunchList;
|
||||||
|
ViewBag.OrderList = orderList;
|
||||||
|
|
||||||
|
// Возвращение представления
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<div class="col-4">Обед:</div>
|
<div class="col-4">Обед:</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<select id="selectedLunch" name="selectedLunch">
|
<select id="selectedLunch" name="selectedLunch">
|
||||||
@foreach (var Lunch in ViewBag.LunchList as List<LunchViewModel>)
|
@foreach (var Lunch in ViewBag.LunchList)
|
||||||
{
|
{
|
||||||
<option value="@Lunch.Id">@Lunch.LunchName</option>
|
<option value="@Lunch.Id">@Lunch.LunchName</option>
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<div class="col-4">Заказ:</div>
|
<div class="col-4">Заказ:</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<select name="selectedOrder">
|
<select name="selectedOrder">
|
||||||
@foreach (var order in ViewBag.OrderList as List<OrderViewModel>)
|
@foreach (var order in ViewBag.OrderList)
|
||||||
{
|
{
|
||||||
<option value="@order.Id">@order.Id</option>
|
<option value="@order.Id">@order.Id</option>
|
||||||
}
|
}
|
||||||
|
@ -13,15 +13,15 @@
|
|||||||
<h4>Pdf</h4>
|
<h4>Pdf</h4>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@Html.LabelFor(m => m.DateBefore, "От")
|
@Html.LabelFor(m => m.DateAfter, "От")
|
||||||
@Html.TextBoxFor(m => m.DateBefore, new { type = "date", @class = "form-control" })
|
@Html.TextBoxFor(m => m.DateAfter, new { type = "date", @class = "form-control" })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@Html.LabelFor(m => m.DateAfter, "До")
|
@Html.LabelFor(m => m.DateBefore, "До")
|
||||||
@Html.TextBoxFor(m => m.DateAfter, new { type = "date", @class = "form-control" })
|
@Html.TextBoxFor(m => m.DateBefore, new { type = "date", @class = "form-control" })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user