Full done
This commit is contained in:
parent
44b11867c9
commit
49f7b0b792
@ -20,8 +20,7 @@ namespace SushiBarClientApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return
|
||||
View(APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorders?clientId={APIClient.Client.Id}"));
|
||||
return View(APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorders?clientId={APIClient.Client.Id}"));
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
|
@ -6,7 +6,7 @@ namespace SushiBarContracts.SearchModels
|
||||
public int? Id { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,11 +40,7 @@ namespace SushiBarDatabaseImplement.Implements
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
using var context = new SushiBarDatabase();
|
||||
if (!model.Id.HasValue && (model.DateFrom == null || model.DateTo == null))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
else
|
||||
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Sushi)
|
||||
@ -53,6 +49,25 @@ namespace SushiBarDatabaseImplement.Implements
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (model.Id.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Sushi)
|
||||
.Include(x => x.Client)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (model.ClientId.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Sushi)
|
||||
.Include(x => x.Client)
|
||||
.Where(x => x.ClientId == model.ClientId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
return new();
|
||||
}
|
||||
public List<OrderViewModel> GetFullList()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user