добавила еще некоторые изменения в классы с заказами

This commit is contained in:
Елена Бакальская 2024-04-20 21:28:08 +04:00
parent 62fc6a34fe
commit c60b75d443
4 changed files with 15 additions and 3 deletions

View File

@ -8,6 +8,10 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" /> <PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />

View File

@ -1,5 +1,4 @@
 using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using SushiBarContracts.BindingModel; using SushiBarContracts.BindingModel;
using SushiBarContracts.SearchModel; using SushiBarContracts.SearchModel;
using SushiBarContracts.StoragesContracts; using SushiBarContracts.StoragesContracts;

View File

@ -11,6 +11,7 @@ namespace SushiBarFileImplement.Models
public int Id { get; private set; } public int Id { get; private set; }
public int SushiId { get; private set; } public int SushiId { get; private set; }
public int ClientId { get; private set; } public int ClientId { get; private set; }
public int? ImplementerId { get; private set; }
public int Count { get; private set; } public int Count { get; private set; }
public double Sum { get; private set; } public double Sum { get; private set; }
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
@ -31,7 +32,8 @@ namespace SushiBarFileImplement.Models
ClientId = model.ClientId, ClientId = model.ClientId,
Status = model.Status, Status = model.Status,
DateCreate = model.DateCreate, DateCreate = model.DateCreate,
DateImplement = model.DateImplement DateImplement = model.DateImplement,
ImplementerId = model.ImplementerId,
}; };
} }
public static Order? Create(XElement element) public static Order? Create(XElement element)
@ -47,6 +49,7 @@ namespace SushiBarFileImplement.Models
ClientId = Convert.ToInt32(element.Element("ClientId")!.Value), ClientId = Convert.ToInt32(element.Element("ClientId")!.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),
ImplementerId = Convert.ToInt32(element.Element("ImplementerId")!.Value),
Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value), Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value),
DateCreate = Convert.ToDateTime(element.Element("DateCreate")!.Value), DateCreate = Convert.ToDateTime(element.Element("DateCreate")!.Value),
DateImplement = string.IsNullOrEmpty(element.Element("DateImplement")!.Value) ? null : DateImplement = string.IsNullOrEmpty(element.Element("DateImplement")!.Value) ? null :
@ -72,12 +75,14 @@ namespace SushiBarFileImplement.Models
DateCreate = DateCreate, DateCreate = DateCreate,
DateImplement = DateImplement, DateImplement = DateImplement,
ClientId = ClientId, ClientId = ClientId,
ImplementerId = ImplementerId,
}; };
public XElement GetXElement => public XElement GetXElement =>
new("Order", new("Order",
new XAttribute("Id", Id), new XAttribute("Id", Id),
new XElement("SushiId", SushiId.ToString()), new XElement("SushiId", SushiId.ToString()),
new XElement("ClientId", ClientId.ToString()), new XElement("ClientId", ClientId.ToString()),
new XElement("ImplementerId", ImplementerId.ToString()),
new XElement("Count", SushiId.ToString()), new XElement("Count", SushiId.ToString()),
new XElement("Sum", Sum.ToString()), new XElement("Sum", Sum.ToString()),
new XElement("Status", Status.ToString()), new XElement("Status", Status.ToString()),

View File

@ -11,6 +11,7 @@ namespace SushiBarListImplements.Models
public int Id { get; private set; } public int Id { get; private set; }
public int SushiId { get; private set; } public int SushiId { get; private set; }
public int ClientId { get; private set; } public int ClientId { get; private set; }
public int? ImplementerId { get; private set; }
public int Count { get; private set; } public int Count { get; private set; }
public double Sum { get; private set; } public double Sum { get; private set; }
public OrderStatus Status { get; private set; } public OrderStatus Status { get; private set; }
@ -33,6 +34,7 @@ namespace SushiBarListImplements.Models
DateCreate = model.DateCreate, DateCreate = model.DateCreate,
DateImplement = model.DateImplement, DateImplement = model.DateImplement,
ClientId = model.ClientId, ClientId = model.ClientId,
ImplementerId = model.ImplementerId,
}; };
} }
@ -49,6 +51,7 @@ namespace SushiBarListImplements.Models
DateCreate = model.DateCreate; DateCreate = model.DateCreate;
DateImplement = model.DateImplement; DateImplement = model.DateImplement;
ClientId = model.ClientId; ClientId = model.ClientId;
ImplementerId = model.ImplementerId;
} }
public OrderViewModel GetViewModel => new() public OrderViewModel GetViewModel => new()
@ -61,6 +64,7 @@ namespace SushiBarListImplements.Models
DateCreate = DateCreate, DateCreate = DateCreate,
DateImplement = DateImplement, DateImplement = DateImplement,
ClientId = ClientId, ClientId = ClientId,
ImplementerId = ImplementerId
}; };
} }
} }