и снова
This commit is contained in:
parent
f203356284
commit
fd64893544
@ -28,6 +28,7 @@ namespace SushiBarFileImplement.Models
|
|||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
SushiId = model.SushiId,
|
SushiId = model.SushiId,
|
||||||
ClientId = model.ClientId,
|
ClientId = model.ClientId,
|
||||||
|
ImplementerId = model.ImplementerId,
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
@ -46,6 +47,7 @@ namespace SushiBarFileImplement.Models
|
|||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||||
SushiId = Convert.ToInt32(element.Element("SushiId")!.Value),
|
SushiId = Convert.ToInt32(element.Element("SushiId")!.Value),
|
||||||
ClientId = Convert.ToInt32(element.Element("ClientId")!.Value),
|
ClientId = Convert.ToInt32(element.Element("ClientId")!.Value),
|
||||||
|
ImplementerId = Convert.ToInt32(element.Element("ImplementerId")!.Value),
|
||||||
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
||||||
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
||||||
Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value.ToString()),
|
Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value.ToString()),
|
||||||
@ -68,6 +70,7 @@ namespace SushiBarFileImplement.Models
|
|||||||
Id = Id,
|
Id = Id,
|
||||||
SushiId = SushiId,
|
SushiId = SushiId,
|
||||||
ClientId = ClientId,
|
ClientId = ClientId,
|
||||||
|
ImplementerId = ImplementerId,
|
||||||
Count = Count,
|
Count = Count,
|
||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
Status = Status,
|
Status = Status,
|
||||||
@ -78,6 +81,7 @@ namespace SushiBarFileImplement.Models
|
|||||||
new XAttribute("Id", Id),
|
new XAttribute("Id", Id),
|
||||||
new XElement("SushiId", SushiId),
|
new XElement("SushiId", SushiId),
|
||||||
new XElement("ClientId", ClientId),
|
new XElement("ClientId", ClientId),
|
||||||
|
new XElement("ImplementerId", ClientId),
|
||||||
new XElement("Count", Count),
|
new XElement("Count", Count),
|
||||||
new XElement("Sum", Sum.ToString()),
|
new XElement("Sum", Sum.ToString()),
|
||||||
new XElement("Status", Status.ToString()),
|
new XElement("Status", Status.ToString()),
|
||||||
|
@ -18,7 +18,7 @@ namespace SushiBarListImplement.Implements
|
|||||||
var result = new List<OrderViewModel>();
|
var result = new List<OrderViewModel>();
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
result.Add(AccessClientStorage(AccessSushiStorage(order.GetViewModel)));
|
result.Add(AccessStorage(order.GetViewModel));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ namespace SushiBarListImplement.Implements
|
|||||||
(model.DateFrom.HasValue && model.DateTo.HasValue &&
|
(model.DateFrom.HasValue && model.DateTo.HasValue &&
|
||||||
model.DateFrom < order.DateCreate && order.DateCreate < model.DateTo))
|
model.DateFrom < order.DateCreate && order.DateCreate < model.DateTo))
|
||||||
{
|
{
|
||||||
result.Add(AccessClientStorage(AccessSushiStorage(order.GetViewModel)));
|
result.Add(AccessStorage(order.GetViewModel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -46,7 +46,7 @@ namespace SushiBarListImplement.Implements
|
|||||||
{
|
{
|
||||||
if (model.Id.HasValue && order.Id == model.Id)
|
if (model.Id.HasValue && order.Id == model.Id)
|
||||||
{
|
{
|
||||||
return AccessClientStorage(AccessSushiStorage(order.GetViewModel));
|
return AccessStorage(order.GetViewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -67,7 +67,7 @@ namespace SushiBarListImplement.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_source.Orders.Add(newOrder);
|
_source.Orders.Add(newOrder);
|
||||||
return AccessClientStorage(AccessSushiStorage(newOrder.GetViewModel));
|
return AccessStorage(newOrder.GetViewModel);
|
||||||
}
|
}
|
||||||
public OrderViewModel? Update(OrderBindingModel model)
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -76,7 +76,7 @@ namespace SushiBarListImplement.Implements
|
|||||||
if (order.Id == model.Id)
|
if (order.Id == model.Id)
|
||||||
{
|
{
|
||||||
order.Update(model);
|
order.Update(model);
|
||||||
return AccessClientStorage(AccessSushiStorage(order.GetViewModel));
|
return AccessStorage(order.GetViewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -89,7 +89,7 @@ namespace SushiBarListImplement.Implements
|
|||||||
{
|
{
|
||||||
var element = _source.Orders[i];
|
var element = _source.Orders[i];
|
||||||
_source.Orders.RemoveAt(i);
|
_source.Orders.RemoveAt(i);
|
||||||
return AccessClientStorage(AccessSushiStorage(element.GetViewModel));
|
return AccessStorage(element.GetViewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -107,11 +107,17 @@ namespace SushiBarListImplement.Implements
|
|||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel AccessClientStorage(OrderViewModel model)
|
public OrderViewModel AccessStorage(OrderViewModel model)
|
||||||
{
|
{
|
||||||
var client = _source.Clients.FirstOrDefault(x => x.Id == model.ClientId);
|
var iceCream = _source.Sushis.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
var client = _source.Clients.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
var implementer = _source.Implementers.FirstOrDefault(x => x.Id == model.ImplementerId);
|
||||||
|
if (iceCream != null)
|
||||||
|
model.SushiName = iceCream.SushiName;
|
||||||
if (client != null)
|
if (client != null)
|
||||||
model.ClientFIO = client.ClientFIO;
|
model.ClientFIO = client.ClientFIO;
|
||||||
|
if (implementer != null)
|
||||||
|
model.ImplementerName = implementer.ImplementerFIO;
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,8 @@ namespace SushiBarListImplement.Models
|
|||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
DateCreate = model.DateCreate,
|
DateCreate = model.DateCreate,
|
||||||
DateImplement = model.DateImplement
|
DateImplement = model.DateImplement,
|
||||||
|
ImplementerId = model.ImplementerId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Update(OrderBindingModel? model)
|
public void Update(OrderBindingModel? model)
|
||||||
@ -41,6 +42,7 @@ namespace SushiBarListImplement.Models
|
|||||||
}
|
}
|
||||||
SushiId = model.SushiId;
|
SushiId = model.SushiId;
|
||||||
ClientId = model.ClientId;
|
ClientId = model.ClientId;
|
||||||
|
ImplementerId = model.ImplementerId;
|
||||||
Count = model.Count;
|
Count = model.Count;
|
||||||
Sum = model.Sum;
|
Sum = model.Sum;
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
@ -51,6 +53,7 @@ namespace SushiBarListImplement.Models
|
|||||||
Id = Id,
|
Id = Id,
|
||||||
SushiId = SushiId,
|
SushiId = SushiId,
|
||||||
ClientId = ClientId,
|
ClientId = ClientId,
|
||||||
|
ImplementerId = ImplementerId,
|
||||||
Count = Count,
|
Count = Count,
|
||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
Status = Status,
|
Status = Status,
|
||||||
|
Loading…
Reference in New Issue
Block a user