fix
This commit is contained in:
parent
36233b487a
commit
e15ecf3e31
@ -163,7 +163,9 @@ namespace CanteenBusinessLogic.BusinessLogics
|
||||
LunchName = _lunch.LunchName,
|
||||
Sum = _lunch.Sum,
|
||||
VisitorId = _lunch.VisitorId,
|
||||
LunchOrders = _lunch.LunchOrders
|
||||
DateImplement = _lunch.DateImplement,
|
||||
LunchOrders = _lunch.LunchOrders,
|
||||
Status = _lunch.Status,
|
||||
|
||||
}) == null)
|
||||
{
|
||||
|
@ -109,7 +109,8 @@ namespace CanteenBusinessLogic.BusinessLogics
|
||||
Id = _order.Id,
|
||||
Description = _order.Description,
|
||||
VisitorId = _order.VisitorId,
|
||||
OrderCooks = _order.OrderCooks
|
||||
OrderCooks = _order.OrderCooks,
|
||||
OrderTablewares = _order.OrderTablewares
|
||||
|
||||
}) == null)
|
||||
{
|
||||
@ -139,7 +140,8 @@ namespace CanteenBusinessLogic.BusinessLogics
|
||||
Id = _order.Id,
|
||||
Description = _order.Description,
|
||||
VisitorId = _order.VisitorId,
|
||||
OrderTablewares = _order.OrderTablewares
|
||||
OrderTablewares = _order.OrderTablewares,
|
||||
OrderCooks = _order.OrderCooks
|
||||
|
||||
}) == null)
|
||||
{
|
||||
|
@ -93,8 +93,8 @@ namespace CanteenBusinessLogic.BusinessLogics
|
||||
|
||||
var lunches = lunchStorage.GetFilteredList(new LunchSearchModel
|
||||
{
|
||||
DateFrom = model.DateBefore,
|
||||
DateTo = model.DateAfter,
|
||||
DateFrom = model.DateAfter,
|
||||
DateTo = model.DateBefore,
|
||||
});
|
||||
|
||||
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;
|
||||
|
@ -34,7 +34,7 @@ namespace CanteenDatabaseImplement.Implements
|
||||
|
||||
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();
|
||||
}
|
||||
@ -47,7 +47,6 @@ namespace CanteenDatabaseImplement.Implements
|
||||
.Include(x => x.Orders)
|
||||
.ThenInclude(x => x.Order)
|
||||
.Where(x =>
|
||||
(model.Id.HasValue && x.Id == model.Id) ||
|
||||
(model.ManagerId.HasValue && model.ManagerId == x.ManagerId) ||
|
||||
(model.OrderId.HasValue && x.Orders.Find(x => x.CookId == model.OrderId) != null))
|
||||
.Select(x => x.GetViewModel)
|
||||
|
@ -63,7 +63,6 @@ namespace CanteenDatabaseImplement.Implements
|
||||
.Include(x => x.Tablewares)
|
||||
.ThenInclude(x => x.Tableware)
|
||||
.Where(x =>
|
||||
(model.Id.HasValue && x.Id == model.Id) ||
|
||||
(model.VisitorId.HasValue && model.VisitorId == x.VisitorId))
|
||||
.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
@ -55,8 +55,7 @@ namespace CanteenDatabaseImplement.Implements
|
||||
return context.Products
|
||||
.Include(x => x.Cooks)
|
||||
.ThenInclude(x => x.Cook)
|
||||
.Where(x => (model.Id.HasValue && x.Id == model.Id) ||
|
||||
(model.ManagerId.HasValue && model.ManagerId == x.ManagerId))
|
||||
.Where(x => (model.ManagerId.HasValue && model.ManagerId == x.ManagerId))
|
||||
.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace CanteenDatabaseImplement.Implements
|
||||
using var context = new CanteenDatabase();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -13,15 +13,15 @@
|
||||
<h4>Pdf</h4>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.DateBefore, "От")
|
||||
@Html.TextBoxFor(m => m.DateBefore, new { type = "date", @class = "form-control" })
|
||||
@Html.LabelFor(m => m.DateAfter, "От")
|
||||
@Html.TextBoxFor(m => m.DateAfter, new { type = "date", @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.DateAfter, "До")
|
||||
@Html.TextBoxFor(m => m.DateAfter, new { type = "date", @class = "form-control" })
|
||||
@Html.LabelFor(m => m.DateBefore, "До")
|
||||
@Html.TextBoxFor(m => m.DateBefore, new { type = "date", @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -558,7 +558,16 @@ namespace CanteenRestApi.Controllers
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -597,7 +606,13 @@ namespace CanteenRestApi.Controllers
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -442,7 +442,7 @@ namespace CanteenVisitorApp.Controllers
|
||||
{
|
||||
Id = id,
|
||||
VisitorId = APIClient.Visitor.Id,
|
||||
LunchName = name
|
||||
LunchName = name,
|
||||
});
|
||||
Response.Redirect("Lunches");
|
||||
}
|
||||
@ -493,8 +493,15 @@ namespace CanteenVisitorApp.Controllers
|
||||
{
|
||||
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();
|
||||
}
|
||||
[HttpPost]
|
||||
|
@ -15,7 +15,7 @@
|
||||
<div class="col-4">Обед:</div>
|
||||
<div class="col-8">
|
||||
<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>
|
||||
}
|
||||
@ -26,7 +26,7 @@
|
||||
<div class="col-4">Заказ:</div>
|
||||
<div class="col-8">
|
||||
<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>
|
||||
}
|
||||
|
@ -13,15 +13,15 @@
|
||||
<h4>Pdf</h4>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.DateBefore, "От")
|
||||
@Html.TextBoxFor(m => m.DateBefore, new { type = "date", @class = "form-control" })
|
||||
@Html.LabelFor(m => m.DateAfter, "От")
|
||||
@Html.TextBoxFor(m => m.DateAfter, new { type = "date", @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(m => m.DateAfter, "До")
|
||||
@Html.TextBoxFor(m => m.DateAfter, new { type = "date", @class = "form-control" })
|
||||
@Html.LabelFor(m => m.DateBefore, "До")
|
||||
@Html.TextBoxFor(m => m.DateBefore, new { type = "date", @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user