Add client to order

This commit is contained in:
Viltskaa 2023-03-26 17:15:42 +04:00
parent 87f51db748
commit 92139ca325
6 changed files with 16 additions and 3 deletions

View File

@ -7,6 +7,7 @@ namespace SushiBarContracts.BindingModels
{ {
public int Id { get; set; } public int Id { get; set; }
public int SushiId { get; set; } public int SushiId { get; set; }
public int ClientId { get; }
public string SushiName { get; set; } = string.Empty; public string SushiName { get; set; } = string.Empty;
public int Count { get; set; } public int Count { get; set; }
public double Sum { get; set; } public double Sum { get; set; }

View File

@ -7,11 +7,13 @@ namespace SushiBarContracts.ViewModels
public class OrderViewModel : IOrderModel public class OrderViewModel : IOrderModel
{ {
[DisplayName("Number")] [DisplayName("Number")]
public int Id { get; set; } public int Id { get; init; }
public int SushiId { get; set; }
public int SushiId { get; init; }
public int ClientId { get; init; }
[DisplayName("Name of Product")] [DisplayName("Name of Product")]
public string SushiName { get; set; } = string.Empty; public string SushiName { get; init; } = string.Empty;
[DisplayName("Count")] [DisplayName("Count")]
public int Count { get; set; } public int Count { get; set; }

View File

@ -11,6 +11,8 @@ namespace SushiBarDatabaseImplement.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 string SushiName { get; private set; } = string.Empty; public string SushiName { get; private set; } = string.Empty;
@ -29,6 +31,8 @@ namespace SushiBarDatabaseImplement.Models
public DateTime? DateImplement { get; private set; } public DateTime? DateImplement { get; private set; }
public virtual Sushi Sushi { get; set; } public virtual Sushi Sushi { get; set; }
public virtual Client Client { get; set; }
public static Order? Create(OrderBindingModel? model) public static Order? Create(OrderBindingModel? model)
{ {
@ -42,6 +46,7 @@ namespace SushiBarDatabaseImplement.Models
Id = model.Id, Id = model.Id,
SushiId = model.SushiId, SushiId = model.SushiId,
SushiName = model.SushiName, SushiName = model.SushiName,
ClientId = model.ClientId,
Count = model.Count, Count = model.Count,
Sum = model.Sum, Sum = model.Sum,
Status = model.Status, Status = model.Status,
@ -59,6 +64,7 @@ namespace SushiBarDatabaseImplement.Models
SushiId = model.SushiId; SushiId = model.SushiId;
SushiName = model.SushiName; SushiName = model.SushiName;
ClientId = model.ClientId;
Count = model.Count; Count = model.Count;
Sum = model.Sum; Sum = model.Sum;
Status = model.Status; Status = model.Status;
@ -71,6 +77,7 @@ namespace SushiBarDatabaseImplement.Models
Id = Id, Id = Id,
SushiId = SushiId, SushiId = SushiId,
SushiName = SushiName, SushiName = SushiName,
ClientId = ClientId,
Count = Count, Count = Count,
Sum = Sum, Sum = Sum,
Status = Status, Status = Status,

View File

@ -11,6 +11,7 @@ namespace SushiBarFileImplement.Models
public int Id { get; private set; } public int Id { get; private set; }
public string SushiName { get; private set; } = string.Empty; public string SushiName { get; private set; } = string.Empty;
public int SushiId { get; private set; } public int SushiId { get; private set; }
public int ClientId { get; }
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.Unknown; public OrderStatus Status { get; private set; } = OrderStatus.Unknown;

View File

@ -5,6 +5,7 @@ namespace SushiBarDataModels.Models
public interface IOrderModel : IId public interface IOrderModel : IId
{ {
int SushiId { get; } int SushiId { get; }
int ClientId { get; }
int Count { get; } int Count { get; }
double Sum { get; } double Sum { get; }
OrderStatus Status { get; } OrderStatus Status { get; }

View File

@ -11,6 +11,7 @@ namespace SushibarListImplement.Models
public int Id { get; private set; } public int Id { get; private set; }
public string SushiName { get; private set; } = string.Empty; public string SushiName { get; private set; } = string.Empty;
public int SushiId { get; private set; } public int SushiId { get; private set; }
public int ClientId { get; }
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; set; } = OrderStatus.Unknown; public OrderStatus Status { get; set; } = OrderStatus.Unknown;