diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Client.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Client.cs index c135fa5..87e24e8 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Client.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Client.cs @@ -3,16 +3,22 @@ using BlacksmithWorkshopContracts.ViewModels; using BlacksmithWorkshopDataModels.Models; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; namespace BlacksmithWorkshopDatabaseImplement.Models { + [DataContract] public class Client : IClientModel { + [DataMember] public int Id { get; private set; } + [DataMember] [Required] public string ClientFIO { get; private set; } = string.Empty; + [DataMember] [Required] public string Email { get; private set; } = string.Empty; + [DataMember] [Required] public string Password { get; private set; } = string.Empty; [ForeignKey("ClientId")] diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Component.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Component.cs index b89c52d..152b2bf 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Component.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Component.cs @@ -3,14 +3,19 @@ using BlacksmithWorkshopContracts.ViewModels; using BlacksmithWorkshopDataModels.Models; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; namespace BlacksmithWorkshopDatabaseImplement.Models { + [DataContract] public class Component : IComponentModel { + [DataMember] public int Id {get; private set;} + [DataMember] [Required] public string ComponentName { get; private set; } = string.Empty; + [DataMember] [Required] public double Cost { get; set; } [ForeignKey("ComponentId")] diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Implementer.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Implementer.cs index ea3eaba..0bc344c 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Implementer.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Implementer.cs @@ -3,18 +3,25 @@ using BlacksmithWorkshopContracts.ViewModels; using BlacksmithWorkshopDataModels.Models; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; namespace BlacksmithWorkshopDatabaseImplement.Models { + [DataContract] public class Implementer : IImplementerModel { + [DataMember] public int Id { get; private set; } + [DataMember] [Required] public string ImplementerFIO { get; private set; } = string.Empty; + [DataMember] [Required] public string Password { get; private set; } = string.Empty; + [DataMember] [Required] public int WorkExperience { get; private set; } + [DataMember] [Required] public int Qualification { get; private set; } //Привязываем исполнителя к заказам один ко многим diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Manufacture.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Manufacture.cs index e9aaf67..ffa8b2c 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Manufacture.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Manufacture.cs @@ -3,14 +3,19 @@ using BlacksmithWorkshopContracts.ViewModels; using BlacksmithWorkshopDataModels.Models; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; namespace BlacksmithWorkshopDatabaseImplement.Models { + [DataContract] public class Manufacture : IManufactureModel { + [DataMember] public int Id { get; set; } + [DataMember] [Required] public string ManufactureName { get; set; } = string.Empty; + [DataMember] [Required] public double Price { get; set; } private Dictionary? _manufactureComponents = null; diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/ManufactureComponent.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/ManufactureComponent.cs index ec51192..5a0f207 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/ManufactureComponent.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/ManufactureComponent.cs @@ -1,14 +1,20 @@ using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; namespace BlacksmithWorkshopDatabaseImplement.Models { + [DataContract] public class ManufactureComponent { + [DataMember] public int Id { get; set; } + [DataMember] [Required] public int ManufactureId { get; set; } + [DataMember] [Required] public int ComponentId { get; set; } + [DataMember] [Required] public int Count { get; set; } public virtual Component Component { get; set; } = new(); diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/MessageInfo.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/MessageInfo.cs index d49ccb2..7ec4915 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/MessageInfo.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/MessageInfo.cs @@ -2,20 +2,27 @@ using BlacksmithWorkshopContracts.ViewModels; using BlacksmithWorkshopDataModels.Models; using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; namespace BlacksmithWorkshopDatabaseImplement.Models { + [DataContract] public class MessageInfo : IMessageInfoModel { + [DataMember] [Key] public string MessageId { get; private set; } = string.Empty; public int? ClientId { get; private set; } + [DataMember] [Required] public string SenderName { get; private set; } = string.Empty; + [DataMember] [Required] public DateTime DateDelivery { get; private set; } = DateTime.Now; + [DataMember] [Required] public string Subject { get; private set; } = string.Empty; + [DataMember] [Required] public string Body { get; private set; } = string.Empty; public Client? Client { get; private set; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Order.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Order.cs index c217dda..ba7a58e 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Order.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatebaseImplement/Models/Order.cs @@ -3,23 +3,33 @@ using BlacksmithWorkshopContracts.ViewModels; using BlacksmithWorkshopDataModels.Enums; using BlacksmithWorkshopDataModels.Models; using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; namespace BlacksmithWorkshopDatabaseImplement.Models { + [DataContract] public class Order : IOrderModel { + [DataMember] public int Id { get; set; } + [DataMember] [Required] public int ManufactureId { get; set; } + [DataMember] [Required] public int Count { get; private set; } + [DataMember] [Required] public double Sum { get; private set; } + [DataMember] [Required] public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; + [DataMember] [Required] public DateTime DateCreate { get; private set; } = DateTime.Now; + [DataMember] public DateTime? DateImplement { get; private set; } + [DataMember] [Required] public int ClientId { get; private set; } [Required] diff --git a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Client.cs b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Client.cs index 1a3e560..b9bb21c 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Client.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Client.cs @@ -1,15 +1,21 @@ using BlacksmithWorkshopContracts.BindingModels; using BlacksmithWorkshopContracts.ViewModels; using BlacksmithWorkshopDataModels.Models; +using System.Runtime.Serialization; using System.Xml.Linq; namespace BlacksmithWorkshopFileImplement.Models { + [DataContract] public class Client : IClientModel { + [DataMember] public int Id { get; private set; } + [DataMember] public string ClientFIO { get; private set; } = string.Empty; + [DataMember] public string Email { get; private set; } = string.Empty; + [DataMember] public string Password { get; private set; } = string.Empty; public static Client? Create(ClientBindingModel model) { diff --git a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Component.cs b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Component.cs index a3aa6cc..e4134be 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Component.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Component.cs @@ -1,15 +1,20 @@ using BlacksmithWorkshopContracts.BindingModels; using BlacksmithWorkshopContracts.ViewModels; using BlacksmithWorkshopDataModels.Models; +using System.Runtime.Serialization; using System.Xml.Linq; namespace BlacksmithWorkshopFileImplement.Models { + [DataContract] public class Component : IComponentModel { + [DataMember] public int Id { get; private set; } + [DataMember] public string ComponentName { get; private set; } = string.Empty; + [DataMember] public double Cost {get; set; } public static Component? Create(ComponentBindingModel model) { diff --git a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Implementer.cs b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Implementer.cs index 49b3d73..dbe27f9 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Implementer.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Implementer.cs @@ -1,16 +1,23 @@ using BlacksmithWorkshopContracts.BindingModels; using BlacksmithWorkshopContracts.ViewModels; using BlacksmithWorkshopDataModels.Models; +using System.Runtime.Serialization; using System.Xml.Linq; namespace BlacksmithWorkshopFileImplement.Models { + [DataContract] public class Implementer : IImplementerModel { + [DataMember] public int Id { get; private set; } + [DataMember] public string ImplementerFIO { get; private set; } = string.Empty; + [DataMember] public string Password { get; private set; } = string.Empty; + [DataMember] public int WorkExperience { get; private set; } + [DataMember] public int Qualification { get; private set; } public static Implementer? Create(XElement element) { diff --git a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Manufacture.cs b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Manufacture.cs index 2ae1b94..33e46c6 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Manufacture.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Manufacture.cs @@ -1,16 +1,22 @@ using BlacksmithWorkshopContracts.BindingModels; using BlacksmithWorkshopContracts.ViewModels; using BlacksmithWorkshopDataModels.Models; +using System.Runtime.Serialization; using System.Xml.Linq; namespace BlacksmithWorkshopFileImplement.Models { + [DataContract] public class Manufacture : IManufactureModel { + [DataMember] public int Id { get; private set; } + [DataMember] public string ManufactureName { get; private set; } = string.Empty; + [DataMember] public double Price { get; private set; } public Dictionary Components { get; private set; } = new(); private Dictionary? _manufactureComponents = null; + [DataMember] public Dictionary ManufactureComponents { get diff --git a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/MessageInfo.cs b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/MessageInfo.cs index 4699514..0274ebd 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/MessageInfo.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/MessageInfo.cs @@ -1,17 +1,25 @@ using BlacksmithWorkshopContracts.BindingModels; using BlacksmithWorkshopContracts.ViewModels; using BlacksmithWorkshopDataModels.Models; +using System.Runtime.Serialization; using System.Xml.Linq; namespace BlacksmithWorkshopFileImplement.Models { + [DataContract] public class MessageInfo : IMessageInfoModel { + [DataMember] public string MessageId { get; private set; } = string.Empty; + [DataMember] public int? ClientId { get; private set; } + [DataMember] public string SenderName { get; private set; } = string.Empty; + [DataMember] public DateTime DateDelivery { get; private set; } = DateTime.Now; + [DataMember] public string Subject { get; private set; } = string.Empty; + [DataMember] public string Body { get; private set; } = string.Empty; public static MessageInfo? Create(MessageInfoBindingModel model) { diff --git a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Order.cs b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Order.cs index 55d50b4..4ff762b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Order.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Order.cs @@ -3,20 +3,31 @@ using BlacksmithWorkshopContracts.ViewModels; using BlacksmithWorkshopDataModels.Enums; using BlacksmithWorkshopDataModels.Models; using System.Reflection; +using System.Runtime.Serialization; using System.Xml.Linq; namespace BlacksmithWorkshopFileImplement.Models { + [DataContract] public class Order : IOrderModel { + [DataMember] public int Id { get; private set; } + [DataMember] public int ManufactureId {get; private set; } + [DataMember] public int Count { get; private set; } + [DataMember] public double Sum { get; private set; } + [DataMember] public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; + [DataMember] public DateTime DateCreate { get; private set; } = DateTime.Now; + [DataMember] public DateTime? DateImplement { get; private set; } + [DataMember] public int ClientId { get; private set; } + [DataMember] public int? ImplementerId { get; set; } public static Order? Create(OrderBindingModel? model) {