order + client (file)
This commit is contained in:
parent
dc2492a0e1
commit
6dc87a5d88
@ -47,11 +47,22 @@ namespace JewelryStoreFileImplement.Implements
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
return source.Orders.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => x.GetViewModel).ToList();
|
||||
if (model.DateFrom.HasValue)
|
||||
return source.Orders
|
||||
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
if (model.ClientId.HasValue && !model.Id.HasValue)
|
||||
return source.Orders
|
||||
.Where(x => x.ClientId == model.ClientId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
if (model.Id.HasValue)
|
||||
return source.Orders
|
||||
.Where(x => x.Id.Equals(model.Id))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
return new();
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFullList()
|
||||
|
@ -5,6 +5,7 @@ using JewelryStoreDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
@ -14,6 +15,7 @@ namespace JewelryStoreFileImplement.Models
|
||||
public class Order : IOrderModel
|
||||
{
|
||||
public int JewelId { get; private set; }
|
||||
public int ClientId { get; private set; }
|
||||
|
||||
public string JewelName { get; private set; } = string.Empty;
|
||||
|
||||
@ -40,6 +42,7 @@ namespace JewelryStoreFileImplement.Models
|
||||
Id = model.Id,
|
||||
JewelId = model.JewelId,
|
||||
JewelName = model.JewelName,
|
||||
ClientId = model.ClientId,
|
||||
Count = model.Count,
|
||||
Sum = model.Sum,
|
||||
Status = model.Status,
|
||||
@ -59,6 +62,7 @@ namespace JewelryStoreFileImplement.Models
|
||||
{
|
||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||
JewelId = Convert.ToInt32(element.Element("JewelId")!.Value),
|
||||
ClientId = Convert.ToInt32(element.Element("ClientId")!.Value),
|
||||
JewelName = element.Element("JewelName")!.Value,
|
||||
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
||||
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
||||
@ -91,6 +95,7 @@ namespace JewelryStoreFileImplement.Models
|
||||
{
|
||||
Id = Id,
|
||||
JewelId = JewelId,
|
||||
ClientId = ClientId,
|
||||
JewelName = JewelName,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
@ -103,6 +108,7 @@ namespace JewelryStoreFileImplement.Models
|
||||
new XAttribute("Id", Id),
|
||||
new XElement("JewelName", JewelName),
|
||||
new XElement("JewelId", JewelId.ToString()),
|
||||
new XElement("ClientId", ClientId.ToString()),
|
||||
new XElement("Count", Count.ToString()),
|
||||
new XElement("Sum", Sum.ToString()),
|
||||
new XElement("Status", Status.ToString()),
|
||||
|
Loading…
Reference in New Issue
Block a user