Исправление заказа
This commit is contained in:
parent
a8888dd285
commit
b91edc375c
@ -39,23 +39,16 @@ namespace SushiBarFileImplement.Models
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var order = new Order()
|
return new Order()
|
||||||
{
|
{
|
||||||
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),
|
||||||
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
|
||||||
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
||||||
DateCreate = DateTime.ParseExact(element.Element("DateCreate")!.Value, "G", null),
|
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
||||||
|
Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value),
|
||||||
|
DateCreate = Convert.ToDateTime(element.Element("DateCreate")!.Value),
|
||||||
|
DateImplement = string.IsNullOrEmpty(element.Element("DateImplement")!.Value) ? null : Convert.ToDateTime(element.Element("DateImplement")!.Value)
|
||||||
};
|
};
|
||||||
DateTime.TryParse(element.Element("DateImplement")!.Value, out DateTime dateImpl);
|
|
||||||
order.DateImplement = dateImpl;
|
|
||||||
|
|
||||||
if (!Enum.TryParse(element.Element("Status")!.Value, out OrderStatus status))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
order.Status = status;
|
|
||||||
return order;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(OrderBindingModel? model)
|
public void Update(OrderBindingModel? model)
|
||||||
|
Loading…
Reference in New Issue
Block a user