From 5b8087029bca06f0101a3aed67a601d552034c76 Mon Sep 17 00:00:00 2001 From: Ino Date: Wed, 12 Apr 2023 11:59:00 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20DataContract=20=D0=B8=20DataMember?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DatabaseImplementationExtension.cs | 22 +++++++++ .../Models/Client.cs | 16 +++++-- .../Models/Component.cs | 14 ++++-- .../Models/IceCream.cs | 16 +++++-- .../Models/Implementer.cs | 19 +++++--- .../Models/MessageInfo.cs | 7 ++- .../Models/Order.cs | 47 +++++++++++++------ .../FileImplementationExtension.cs | 22 +++++++++ .../Implements/BackUpInfo.cs | 29 ++++++++++++ .../Models/Client.cs | 16 +++++-- .../Models/Component.cs | 15 ++++-- .../Models/IceCream.cs | 19 ++++++-- .../Models/Implementer.cs | 7 +++ .../Models/MessageInfo.cs | 22 ++++++--- .../IceCreamShopFileImplement/Models/Order.cs | 31 ++++++++---- .../Models/Client.cs | 16 +++++-- .../Models/Component.cs | 15 ++++-- .../Models/IceCream.cs | 19 ++++++-- .../Models/Implementer.cs | 7 +++ .../Models/MessageInfo.cs | 22 ++++++--- .../IceCreamShopListImplement/Models/Order.cs | 31 ++++++++---- 21 files changed, 312 insertions(+), 100 deletions(-) create mode 100644 IceCreamShop/IceCreamShopDatabaseImplement/DatabaseImplementationExtension.cs create mode 100644 IceCreamShop/IceCreamShopFileImplement/FileImplementationExtension.cs create mode 100644 IceCreamShop/IceCreamShopFileImplement/Implements/BackUpInfo.cs diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/DatabaseImplementationExtension.cs b/IceCreamShop/IceCreamShopDatabaseImplement/DatabaseImplementationExtension.cs new file mode 100644 index 0000000..5bb9e42 --- /dev/null +++ b/IceCreamShop/IceCreamShopDatabaseImplement/DatabaseImplementationExtension.cs @@ -0,0 +1,22 @@ +using IceCreamShopContracts.DI; +using IceCreamShopContracts.StoragesContracts; +using IceCreamShopDatabaseImplement.Implements; + +namespace IceCreamShopDatabaseImplement +{ + public class DatabaseImplementationExtension : IImplementationExtension + { + public int Priority => 2; + + public void RegisterServices() + { + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + } + } +} diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Models/Client.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Models/Client.cs index d581f9d..c570085 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/Models/Client.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Models/Client.cs @@ -3,21 +3,27 @@ using IceCreamShopContracts.ViewModels; using AbstractIceCreamShopDataModels.Models; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; namespace IceCreamShopDatabaseImplement.Models { - public class Client : IClientModel + [DataContract] + public class Client : IClientModel { [Required] - public string ClientFIO { get; private set; } = string.Empty; + [DataMember] + public string ClientFIO { get; private set; } = string.Empty; [Required] - public string Email { get; private set; } = string.Empty; + [DataMember] + public string Email { get; private set; } = string.Empty; [Required] - public string Password { get; private set; } = string.Empty; + [DataMember] + public string Password { get; private set; } = string.Empty; - public int Id { get; private set; } + [DataMember] + public int Id { get; private set; } [ForeignKey("ClientId")] public virtual List Orders { get; set; } = new(); diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Models/Component.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Models/Component.cs index 40c83db..0d16480 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/Models/Component.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Models/Component.cs @@ -3,19 +3,23 @@ using System.ComponentModel.DataAnnotations; using IceCreamShopContracts.BindingModels; using IceCreamShopContracts.ViewModels; using AbstractIceCreamShopDataModels.Models; - +using System.Runtime.Serialization; namespace IceCreamShopDatabaseImplement.Models { - public class Component : IComponentModel + [DataContract] + public class Component : IComponentModel { - public int Id { get; private set; } + [DataMember] + public int Id { get; private set; } [Required] - public string ComponentName { get; private set; } = string.Empty; + [DataMember] + public string ComponentName { get; private set; } = string.Empty; [Required] - public double Cost { get; set; } + [DataMember] + public double Cost { get; set; } [ForeignKey("ComponentId")] public virtual List IceCreamComponents { get; set; } = new(); diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Models/IceCream.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Models/IceCream.cs index 7993d94..7fcb106 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/Models/IceCream.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Models/IceCream.cs @@ -3,23 +3,29 @@ using IceCreamShopContracts.BindingModels; using IceCreamShopContracts.ViewModels; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; namespace IceCreamShopDatabaseImplement.Models { - public class IceCream : IIceCreamModel + [DataContract] + public class IceCream : IIceCreamModel { - public int Id { get; set; } + [DataMember] + public int Id { get; set; } [Required] - public string IceCreamName { get; set; } = string.Empty; + [DataMember] + public string IceCreamName { get; set; } = string.Empty; [Required] - public double Price { get; set; } + [DataMember] + public double Price { get; set; } private Dictionary? _iceCreamComponents = null; [NotMapped] - public Dictionary IceCreamComponents + [DataMember] + public Dictionary IceCreamComponents { get { diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Models/Implementer.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Models/Implementer.cs index 9881eb4..be610ed 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/Models/Implementer.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Models/Implementer.cs @@ -2,20 +2,27 @@ using IceCreamShopContracts.BindingModels; using IceCreamShopContracts.ViewModels; using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; namespace IceCreamShopDatabaseImplement.Models { - public class Implementer : IImplementerModel + [DataContract] + public class Implementer : IImplementerModel { - public int Id { get; private set; } + [DataMember] + public int Id { get; private set; } - public string ImplementerFIO { get; private set; } = string.Empty; + [DataMember] + public string ImplementerFIO { get; private set; } = string.Empty; - public string Password { get; private set; } = string.Empty; + [DataMember] + public string Password { get; private set; } = string.Empty; - public int WorkExperience { get; private set; } + [DataMember] + public int WorkExperience { get; private set; } - public int Qualification { get; private set; } + [DataMember] + public int Qualification { get; private set; } [ForeignKey("ImplementerId")] public virtual List Orders { get; private set; } = new(); diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Models/MessageInfo.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Models/MessageInfo.cs index 6e95abf..3edf4f7 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/Models/MessageInfo.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Models/MessageInfo.cs @@ -2,13 +2,16 @@ using IceCreamShopContracts.BindingModels; using IceCreamShopContracts.ViewModels; using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; namespace IceCreamShopDatabaseImplement.Models { - public class MessageInfo : IMessageInfoModel + [DataContract] + public class MessageInfo : IMessageInfoModel { [Key] - public string MessageId { get; private set; } = string.Empty; + [DataMember] + public string MessageId { get; private set; } = string.Empty; public int? ClientId { get; private set; } diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Models/Order.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Models/Order.cs index 4b0b6ac..95fb1d6 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/Models/Order.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Models/Order.cs @@ -4,28 +4,45 @@ using IceCreamShopContracts.BindingModels; using IceCreamShopContracts.ViewModels; using System.ComponentModel.DataAnnotations; using System.Reflection.Metadata; +using System.Runtime.Serialization; namespace IceCreamShopDatabaseImplement.Models { - public class Order : IOrderModel + [DataContract] + public class Order : IOrderModel { [Required] - public int IceCreamId { get; set; } - [Required] - public int ClientId { get; private set; } - public int? ImplementerId { get; private set; } - [Required] - public int Count { get; set; } - [Required] - public double Sum { get; set; } - [Required] - public OrderStatus Status { get; set; } - [Required] - public DateTime DateCreate { get; set; } + [DataMember] + public int IceCreamId { get; private set; } - public DateTime? DateImplement { get; set; } + [Required] + [DataMember] + public int ClientId { get; private set; } - public int Id { get; set; } + [DataMember] + public int? ImplementerId { get; private set; } + + [Required] + [DataMember] + public int Count { get; private set; } + + [Required] + [DataMember] + public double Sum { get; private set; } + + [Required] + [DataMember] + public OrderStatus Status { get; private set; } + + [Required] + [DataMember] + public DateTime DateCreate { get; private set; } + + [DataMember] + public DateTime? DateImplement { get; private set; } + + [DataMember] + public int Id { get; set; } public virtual IceCream IceCream{ get; private set; } public virtual Client Client { get; private set; } public Implementer? Implementer { get; private set; } diff --git a/IceCreamShop/IceCreamShopFileImplement/FileImplementationExtension.cs b/IceCreamShop/IceCreamShopFileImplement/FileImplementationExtension.cs new file mode 100644 index 0000000..c177c3a --- /dev/null +++ b/IceCreamShop/IceCreamShopFileImplement/FileImplementationExtension.cs @@ -0,0 +1,22 @@ +using IceCreamShopContracts.DI; +using IceCreamShopContracts.StoragesContracts; +using IceCreamShopFileImplement.Implements; + +namespace IceCreamShopFileImplement +{ + public class FileImplementationExtension : IImplementationExtension + { + public int Priority => 1; + + public void RegisterServices() + { + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + } + } +} diff --git a/IceCreamShop/IceCreamShopFileImplement/Implements/BackUpInfo.cs b/IceCreamShop/IceCreamShopFileImplement/Implements/BackUpInfo.cs new file mode 100644 index 0000000..755de87 --- /dev/null +++ b/IceCreamShop/IceCreamShopFileImplement/Implements/BackUpInfo.cs @@ -0,0 +1,29 @@ +using IceCreamShopContracts.StoragesContracts; + +namespace IceCreamShopFileImplement.Implements +{ + public class BackUpInfo : IBackUpInfo + { + public List? GetList() where T : class, new() + { + // Получаем значения из singleton-объекта универсального свойства содержащее тип T + var source = DataFileSingleton.GetInstance(); + return (List?)source.GetType().GetProperties() + .FirstOrDefault(x => x.PropertyType.IsGenericType && x.PropertyType.GetGenericArguments()[0] == typeof(T)) + ?.GetValue(source); + } + public Type? GetTypeByModelInterface(string modelInterfaceName) + { + var assembly = typeof(BackUpInfo).Assembly; + var types = assembly.GetTypes(); + foreach (var type in types) + { + if (type.IsClass && type.GetInterface(modelInterfaceName) != null) + { + return type; + } + } + return null; + } + } +} diff --git a/IceCreamShop/IceCreamShopFileImplement/Models/Client.cs b/IceCreamShop/IceCreamShopFileImplement/Models/Client.cs index 9a2ec8c..329ebeb 100644 --- a/IceCreamShop/IceCreamShopFileImplement/Models/Client.cs +++ b/IceCreamShop/IceCreamShopFileImplement/Models/Client.cs @@ -2,18 +2,24 @@ using IceCreamShopContracts.ViewModels; using AbstractIceCreamShopDataModels.Models; using System.Xml.Linq; +using System.Runtime.Serialization; namespace IceCreamShopFileImplement.Models { - public class Client : IClientModel + [DataContract] + public class Client : IClientModel { - public string ClientFIO { get; private set; } = string.Empty; + [DataMember] + public string ClientFIO { get; private set; } = string.Empty; - public string Email { get; private set; } = string.Empty; + [DataMember] + public string Email { get; private set; } = string.Empty; - public string Password { get; private set; } = string.Empty; + [DataMember] + public string Password { get; private set; } = string.Empty; - public int Id { get; private set; } + [DataMember] + public int Id { get; private set; } public static Client? Create(ClientBindingModel model) { diff --git a/IceCreamShop/IceCreamShopFileImplement/Models/Component.cs b/IceCreamShop/IceCreamShopFileImplement/Models/Component.cs index 01bd975..2c581e9 100644 --- a/IceCreamShop/IceCreamShopFileImplement/Models/Component.cs +++ b/IceCreamShop/IceCreamShopFileImplement/Models/Component.cs @@ -7,14 +7,21 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; +using System.Runtime.Serialization; namespace IceCreamShopFileImplement.Models { - public class Component : IComponentModel + [DataContract] + public class Component : IComponentModel { - public int Id { get; private set; } - public string ComponentName { get; private set; } = string.Empty; - public double Cost { get; set; } + [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) { if (model == null) diff --git a/IceCreamShop/IceCreamShopFileImplement/Models/IceCream.cs b/IceCreamShop/IceCreamShopFileImplement/Models/IceCream.cs index 54d4d38..fda7848 100644 --- a/IceCreamShop/IceCreamShopFileImplement/Models/IceCream.cs +++ b/IceCreamShop/IceCreamShopFileImplement/Models/IceCream.cs @@ -7,17 +7,26 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; +using System.Runtime.Serialization; namespace IceCreamShopFileImplement.Models { - public class IceCream : IIceCreamModel + [DataContract] + public class IceCream : IIceCreamModel { - public int Id { get; private set; } - public string IceCreamName { get; private set; } = string.Empty; - public double Price { get; private set; } + [DataMember] + public int Id { get; private set; } + + [DataMember] + public string IceCreamName { get; private set; } = string.Empty; + + [DataMember] + public double Price { get; private set; } public Dictionary Components { get; private set; } = new(); private Dictionary? _iceCreamComponents = null; - public Dictionary IceCreamComponents + + [DataMember] + public Dictionary IceCreamComponents { get { diff --git a/IceCreamShop/IceCreamShopFileImplement/Models/Implementer.cs b/IceCreamShop/IceCreamShopFileImplement/Models/Implementer.cs index 3d0fe22..73cef51 100644 --- a/IceCreamShop/IceCreamShopFileImplement/Models/Implementer.cs +++ b/IceCreamShop/IceCreamShopFileImplement/Models/Implementer.cs @@ -2,19 +2,26 @@ using IceCreamShopContracts.ViewModels; using AbstractIceCreamShopDataModels.Models; using System.Xml.Linq; +using System.Runtime.Serialization; namespace IceCreamShopFileImplement.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/IceCreamShop/IceCreamShopFileImplement/Models/MessageInfo.cs b/IceCreamShop/IceCreamShopFileImplement/Models/MessageInfo.cs index 244d052..fb53164 100644 --- a/IceCreamShop/IceCreamShopFileImplement/Models/MessageInfo.cs +++ b/IceCreamShop/IceCreamShopFileImplement/Models/MessageInfo.cs @@ -1,23 +1,31 @@ using AbstractIceCreamShopDataModels.Models; using IceCreamShopContracts.BindingModels; using IceCreamShopContracts.ViewModels; +using System.Runtime.Serialization; using System.Xml.Linq; namespace IceCreamShopFileImplement.Models { - public class MessageInfo : IMessageInfoModel + [DataContract] + public class MessageInfo : IMessageInfoModel { - public string MessageId { get; private set; } = string.Empty; + [DataMember] + public string MessageId { get; private set; } = string.Empty; - public int? ClientId { get; private set; } + [DataMember] + public int? ClientId { get; private set; } - public string SenderName { get; private set; } = string.Empty; + [DataMember] + public string SenderName { get; private set; } = string.Empty; - public DateTime DateDelivery { get; private set; } = DateTime.Now; + [DataMember] + public DateTime DateDelivery { get; private set; } = DateTime.Now; - public string Subject { get; private set; } = string.Empty; + [DataMember] + public string Subject { get; private set; } = string.Empty; - public string Body { get; private set; } = string.Empty; + [DataMember] + public string Body { get; private set; } = string.Empty; public static MessageInfo? Create(MessageInfoBindingModel model) { diff --git a/IceCreamShop/IceCreamShopFileImplement/Models/Order.cs b/IceCreamShop/IceCreamShopFileImplement/Models/Order.cs index 0f1aa02..b9b3605 100644 --- a/IceCreamShop/IceCreamShopFileImplement/Models/Order.cs +++ b/IceCreamShop/IceCreamShopFileImplement/Models/Order.cs @@ -9,28 +9,39 @@ using System.Threading.Tasks; using AbstractIceCreamShopDataModels.Enums; using System.Xml.Linq; using System.Reflection.Metadata; +using System.Runtime.Serialization; namespace IceCreamShopFileImplement.Models { - public class Order : IOrderModel + [DataContract] + public class Order : IOrderModel { - public int Id { get; private set; } + [DataMember] + public int Id { get; private set; } - public int IceCreamId { get; private set; } + [DataMember] + public int IceCreamId { get; private set; } - public int? ImplementerId { get; set; } + [DataMember] + public int? ImplementerId { get; set; } - public int ClientId { get; set; } + [DataMember] + public int ClientId { get; set; } - public int Count { get; private set; } + [DataMember] + public int Count { get; private set; } - public double Sum { get; private set; } + [DataMember] + public double Sum { get; private set; } - public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; + [DataMember] + public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; - public DateTime DateCreate { get; private set; } = DateTime.Now; + [DataMember] + public DateTime DateCreate { get; private set; } = DateTime.Now; - public DateTime? DateImplement { get; private set; } + [DataMember] + public DateTime? DateImplement { get; private set; } public static Order? Create(OrderBindingModel? model) { if (model == null) diff --git a/IceCreamShop/IceCreamShopListImplement/Models/Client.cs b/IceCreamShop/IceCreamShopListImplement/Models/Client.cs index 76ae3a6..8809570 100644 --- a/IceCreamShop/IceCreamShopListImplement/Models/Client.cs +++ b/IceCreamShop/IceCreamShopListImplement/Models/Client.cs @@ -1,18 +1,24 @@ using IceCreamShopContracts.BindingModels; using IceCreamShopContracts.ViewModels; using AbstractIceCreamShopDataModels.Models; +using System.Runtime.Serialization; namespace IceCreamShopListImplement.Models { - public class Client : IClientModel + [DataContract] + public class Client : IClientModel { - public string ClientFIO { get; private set; } = string.Empty; + [DataMember] + public string ClientFIO { get; private set; } = string.Empty; - public string Email { get; private set; } = string.Empty; + [DataMember] + public string Email { get; private set; } = string.Empty; - public string Password { get; private set; } = string.Empty; + [DataMember] + public string Password { get; private set; } = string.Empty; - public int Id { get; private set; } + [DataMember] + public int Id { get; private set; } public static Client? Create(ClientBindingModel model) { diff --git a/IceCreamShop/IceCreamShopListImplement/Models/Component.cs b/IceCreamShop/IceCreamShopListImplement/Models/Component.cs index b2b116f..241c851 100644 --- a/IceCreamShop/IceCreamShopListImplement/Models/Component.cs +++ b/IceCreamShop/IceCreamShopListImplement/Models/Component.cs @@ -6,14 +6,21 @@ using System.Threading.Tasks; using IceCreamShopContracts.BindingModels; using IceCreamShopContracts.ViewModels; using AbstractIceCreamShopDataModels.Models; +using System.Runtime.Serialization; namespace IceCreamShopListImplement.Models { - public class Component : IComponentModel + [DataContract] + public class Component : IComponentModel { - public int Id { get; private set; } - public string ComponentName { get; private set; } = string.Empty; - public double Cost { get; set; } + [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) { if (model == null) diff --git a/IceCreamShop/IceCreamShopListImplement/Models/IceCream.cs b/IceCreamShop/IceCreamShopListImplement/Models/IceCream.cs index b595c46..a48f360 100644 --- a/IceCreamShop/IceCreamShopListImplement/Models/IceCream.cs +++ b/IceCreamShop/IceCreamShopListImplement/Models/IceCream.cs @@ -4,18 +4,27 @@ using IceCreamShopContracts.ViewModels; using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace IceCreamShopListImplement.Models { - public class IceCream : IIceCreamModel + [DataContract] + public class IceCream : IIceCreamModel { - public int Id { get; private set; } - public string IceCreamName { get; private set; } = string.Empty; - public double Price { get; private set; } - public Dictionary IceCreamComponents + [DataMember] + public int Id { get; private set; } + + [DataMember] + public string IceCreamName { get; private set; } = string.Empty; + + [DataMember] + public double Price { get; private set; } + + [DataMember] + public Dictionary IceCreamComponents { get; private set; diff --git a/IceCreamShop/IceCreamShopListImplement/Models/Implementer.cs b/IceCreamShop/IceCreamShopListImplement/Models/Implementer.cs index aa0ce17..97b059c 100644 --- a/IceCreamShop/IceCreamShopListImplement/Models/Implementer.cs +++ b/IceCreamShop/IceCreamShopListImplement/Models/Implementer.cs @@ -1,19 +1,26 @@ using IceCreamShopContracts.BindingModels; using IceCreamShopContracts.ViewModels; using AbstractIceCreamShopDataModels.Models; +using System.Runtime.Serialization; namespace IceCreamShopListImplement.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(ImplementerBindingModel model) diff --git a/IceCreamShop/IceCreamShopListImplement/Models/MessageInfo.cs b/IceCreamShop/IceCreamShopListImplement/Models/MessageInfo.cs index b8dc980..c514550 100644 --- a/IceCreamShop/IceCreamShopListImplement/Models/MessageInfo.cs +++ b/IceCreamShop/IceCreamShopListImplement/Models/MessageInfo.cs @@ -1,22 +1,30 @@ using AbstractIceCreamShopDataModels.Models; using IceCreamShopContracts.BindingModels; using IceCreamShopContracts.ViewModels; +using System.Runtime.Serialization; namespace IceCreamShopListImplement.Models { - public class MessageInfo : IMessageInfoModel + [DataContract] + public class MessageInfo : IMessageInfoModel { - public string MessageId { get; private set; } = string.Empty; + [DataMember] + public string MessageId { get; private set; } = string.Empty; - public int? ClientId { get; private set; } + [DataMember] + public int? ClientId { get; private set; } - public string SenderName { get; private set; } = string.Empty; + [DataMember] + public string SenderName { get; private set; } = string.Empty; - public DateTime DateDelivery { get; private set; } = DateTime.Now; + [DataMember] + public DateTime DateDelivery { get; private set; } = DateTime.Now; - public string Subject { get; private set; } = string.Empty; + [DataMember] + public string Subject { get; private set; } = string.Empty; - public string Body { get; private set; } = string.Empty; + [DataMember] + public string Body { get; private set; } = string.Empty; public static MessageInfo? Create(MessageInfoBindingModel model) { diff --git a/IceCreamShop/IceCreamShopListImplement/Models/Order.cs b/IceCreamShop/IceCreamShopListImplement/Models/Order.cs index f6c7f6e..fbd9849 100644 --- a/IceCreamShop/IceCreamShopListImplement/Models/Order.cs +++ b/IceCreamShop/IceCreamShopListImplement/Models/Order.cs @@ -9,28 +9,39 @@ using AbstractIceCreamShopDataModels.Models; using AbstractIceCreamShopDataModels.Enums; using System.Data; using System.Reflection; +using System.Runtime.Serialization; namespace IceCreamShopListImplement.Models { - public class Order : IOrderModel + [DataContract] + public class Order : IOrderModel { - public int Id { get; private set; } + [DataMember] + public int Id { get; private set; } - public int IceCreamId { get; private set; } + [DataMember] + public int IceCreamId { get; private set; } - public int ClientId { get; private set; } + [DataMember] + public int ClientId { get; private set; } - public int? ImplementerId { get; private set; } + [DataMember] + public int? ImplementerId { get; private set; } - public int Count { get; private set; } + [DataMember] + public int Count { get; private set; } - public double Sum { get; private set; } + [DataMember] + public double Sum { get; private set; } - public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; + [DataMember] + public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; - public DateTime DateCreate { get; private set; } = DateTime.Now; + [DataMember] + public DateTime DateCreate { get; private set; } = DateTime.Now; - public DateTime? DateImplement { get; private set; } + [DataMember] + public DateTime? DateImplement { get; private set; } public static Order? Create (OrderBindingModel? model) {