Добавил поле фио работника во view модель заказа, порписал поле id в модели бд

This commit is contained in:
Никита Потапов 2024-04-22 10:18:23 +04:00
parent 452f66187c
commit 6a118d4622
2 changed files with 9 additions and 1 deletions

View File

@ -11,6 +11,8 @@ namespace SecuritySystemContracts.ViewModels
public int ClientId { get; set; } public int ClientId { get; set; }
public int SecureId { get; set; } public int SecureId { get; set; }
public int? ImplementerId { get; set; } public int? ImplementerId { get; set; }
[DisplayName("ФИО работника")]
public string ImplementerFIO { get; set; } = string.Empty;
[DisplayName("ФИО клиента")] [DisplayName("ФИО клиента")]
public string ClientFIO { get; set; } = string.Empty; public string ClientFIO { get; set; } = string.Empty;
[DisplayName("Изделие")] [DisplayName("Изделие")]

View File

@ -13,6 +13,7 @@ namespace SecuritySystemDatabaseImplement.Models
public int SecureId { get; private set; } public int SecureId { get; private set; }
[Required] [Required]
public int ClientId { get; private set; } public int ClientId { get; private set; }
public int? ImplementerId { get; private set; }
[Required] [Required]
public int Count { get; private set; } public int Count { get; private set; }
[Required] [Required]
@ -24,6 +25,7 @@ namespace SecuritySystemDatabaseImplement.Models
public DateTime? DateImplement { get; private set; } public DateTime? DateImplement { get; private set; }
public virtual Secure Secure { get; private set; } public virtual Secure Secure { get; private set; }
public virtual Client Client { get; private set; } public virtual Client Client { get; private set; }
public virtual Implementer Implementer { get; private set; }
public static Order? Create(OrderBindingModel? model) public static Order? Create(OrderBindingModel? model)
{ {
if (model == null) if (model == null)
@ -40,6 +42,7 @@ namespace SecuritySystemDatabaseImplement.Models
DateCreate = model.DateCreate, DateCreate = model.DateCreate,
DateImplement = model.DateImplement, DateImplement = model.DateImplement,
Id = model.Id, Id = model.Id,
ImplementerId = model.ImplementerId
}; };
} }
@ -51,6 +54,7 @@ namespace SecuritySystemDatabaseImplement.Models
} }
Status = model.Status; Status = model.Status;
DateImplement = model.DateImplement; DateImplement = model.DateImplement;
ImplementerId = model.ImplementerId;
} }
public OrderViewModel GetViewModel => new() public OrderViewModel GetViewModel => new()
@ -64,7 +68,9 @@ namespace SecuritySystemDatabaseImplement.Models
Id = Id, Id = Id,
Status = Status, Status = Status,
SecureName = Secure.SecureName, SecureName = Secure.SecureName,
ClientFIO = Client.ClientFIO ClientFIO = Client.ClientFIO,
ImplementerId = ImplementerId,
ImplementerFIO = Implementer.ImplementerFIO
}; };
} }
} }