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 SushiId { get; set; }
public int ClientId { get; }
public string SushiName { get; set; } = string.Empty;
public int Count { get; set; }
public double Sum { get; set; }

View File

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

View File

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

View File

@ -11,6 +11,7 @@ namespace SushiBarFileImplement.Models
public int Id { get; private set; }
public string SushiName { get; private set; } = string.Empty;
public int SushiId { get; private set; }
public int ClientId { get; }
public int Count { get; private set; }
public double Sum { get; private set; }
public OrderStatus Status { get; private set; } = OrderStatus.Unknown;

View File

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

View File

@ -11,6 +11,7 @@ namespace SushibarListImplement.Models
public int Id { get; private set; }
public string SushiName { get; private set; } = string.Empty;
public int SushiId { get; private set; }
public int ClientId { get; }
public int Count { get; private set; }
public double Sum { get; private set; }
public OrderStatus Status { get; set; } = OrderStatus.Unknown;