diff --git a/SushiBar/ImplementationExtensions/SushiBarContracts.dll b/SushiBar/ImplementationExtensions/SushiBarContracts.dll index f9a25d3..194d57b 100644 Binary files a/SushiBar/ImplementationExtensions/SushiBarContracts.dll and b/SushiBar/ImplementationExtensions/SushiBarContracts.dll differ diff --git a/SushiBar/ImplementationExtensions/SushiBarDataModels.dll b/SushiBar/ImplementationExtensions/SushiBarDataModels.dll index 0c1d40a..502b2a1 100644 Binary files a/SushiBar/ImplementationExtensions/SushiBarDataModels.dll and b/SushiBar/ImplementationExtensions/SushiBarDataModels.dll differ diff --git a/SushiBar/ImplementationExtensions/SushiBarDatabaseImplement.dll b/SushiBar/ImplementationExtensions/SushiBarDatabaseImplement.dll index 66b4ea0..cd45e62 100644 Binary files a/SushiBar/ImplementationExtensions/SushiBarDatabaseImplement.dll and b/SushiBar/ImplementationExtensions/SushiBarDatabaseImplement.dll differ diff --git a/SushiBar/ImplementationExtensions/SushiBarFileImplement.dll b/SushiBar/ImplementationExtensions/SushiBarFileImplement.dll index 9f365a1..350a03c 100644 Binary files a/SushiBar/ImplementationExtensions/SushiBarFileImplement.dll and b/SushiBar/ImplementationExtensions/SushiBarFileImplement.dll differ diff --git a/SushiBar/ImplementationExtensions/SushiBarListImplement.dll b/SushiBar/ImplementationExtensions/SushiBarListImplement.dll index b8a79d1..d85b83f 100644 Binary files a/SushiBar/ImplementationExtensions/SushiBarListImplement.dll and b/SushiBar/ImplementationExtensions/SushiBarListImplement.dll differ diff --git a/SushiBar/SushiBar/ImplementationExtensions.dll b/SushiBar/SushiBar/ImplementationExtensions.dll deleted file mode 100644 index a5c8c73..0000000 Binary files a/SushiBar/SushiBar/ImplementationExtensions.dll and /dev/null differ diff --git a/SushiBar/SushiBar/ImplementationExtensionst.dll b/SushiBar/SushiBar/ImplementationExtensionst.dll deleted file mode 100644 index d9be805..0000000 Binary files a/SushiBar/SushiBar/ImplementationExtensionst.dll and /dev/null differ diff --git a/SushiBar/SushiBar/SushiBar.csproj b/SushiBar/SushiBar/SushiBar.csproj index 954cb20..62b806d 100644 --- a/SushiBar/SushiBar/SushiBar.csproj +++ b/SushiBar/SushiBar/SushiBar.csproj @@ -27,6 +27,9 @@ + + Always + PreserveNewest diff --git a/SushiBar/SushiBarDatabaseImplement/Models/Client.cs b/SushiBar/SushiBarDatabaseImplement/Models/Client.cs index 936bd1a..5b3a0c9 100644 --- a/SushiBar/SushiBarDatabaseImplement/Models/Client.cs +++ b/SushiBar/SushiBarDatabaseImplement/Models/Client.cs @@ -3,18 +3,24 @@ using SushiBarContracts.ViewModels; using SushiBarDataModels.Models; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; namespace SushiBarDatabaseImplement.Models { - public class Client : IClientModel + [DataContract] + public class Client : IClientModel { - public int Id { get; private set; } - [Required] - public string ClientFIO { get; private set; } = string.Empty; - [Required] - public string Email { get; private set; } = string.Empty; - [Required] - public string Password { get; private set; } = string.Empty; + [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")] public List Messages = new(); diff --git a/SushiBar/SushiBarDatabaseImplement/Models/Component.cs b/SushiBar/SushiBarDatabaseImplement/Models/Component.cs index df26753..085903e 100644 --- a/SushiBar/SushiBarDatabaseImplement/Models/Component.cs +++ b/SushiBar/SushiBarDatabaseImplement/Models/Component.cs @@ -3,16 +3,21 @@ using SushiBarContracts.ViewModels; using SushiBarDataModels.Models; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; namespace SushiBarDatabaseImplement.Models { - public class Component : IComponentModel + [DataContract] + public class Component : IComponentModel { - public int Id { get; private set; } - [Required] - public string ComponentName { get; private set; } = string.Empty; - [Required] - public double Cost { get; set; } + [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")] public virtual List SushiComponents { get; set; } = new(); public static Component? Create(ComponentBindingModel model) diff --git a/SushiBar/SushiBarDatabaseImplement/Models/Implementer.cs b/SushiBar/SushiBarDatabaseImplement/Models/Implementer.cs index 950256f..6d634a4 100644 --- a/SushiBar/SushiBarDatabaseImplement/Models/Implementer.cs +++ b/SushiBar/SushiBarDatabaseImplement/Models/Implementer.cs @@ -3,18 +3,25 @@ using System.ComponentModel.DataAnnotations; using SushiBarDataModels.Models; using SushiBarContracts.BindingModels; using SushiBarContracts.ViewModels; +using System.Runtime.Serialization; namespace SushiBarDatabaseImplement.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; set; } = string.Empty; + [DataMember] [Required] public int Qualification { get; set; } = 0; + [DataMember] [Required] public int WorkExperience { get; set; } = 0; [ForeignKey("ImplementerId")] diff --git a/SushiBar/SushiBarDatabaseImplement/Models/MessageInfo.cs b/SushiBar/SushiBarDatabaseImplement/Models/MessageInfo.cs index db851df..bce621d 100644 --- a/SushiBar/SushiBarDatabaseImplement/Models/MessageInfo.cs +++ b/SushiBar/SushiBarDatabaseImplement/Models/MessageInfo.cs @@ -2,23 +2,26 @@ using SushiBarContracts.ViewModels; using SushiBarDataModels.Models; using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; namespace SushiBarDatabaseImplement.Models { - public class MessageInfo : IMessageInfoModel + [DataContract] + public class MessageInfo : IMessageInfoModel { - [Key] + [DataMember] + [Key] public string MessageId { get; private set; } = string.Empty; - - public int? ClientId { get; private set; } - - public string SenderName { get; private set; } = string.Empty; - - public DateTime DateDelivery { get; private set; } = DateTime.Now; - - public string Subject { get; private set; } = string.Empty; - - public string Body { 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 Client? Client; public static MessageInfo? Create(SushiBarDatabase context, MessageInfoBindingModel model) { diff --git a/SushiBar/SushiBarDatabaseImplement/Models/Order.cs b/SushiBar/SushiBarDatabaseImplement/Models/Order.cs index 3000751..5240952 100644 --- a/SushiBar/SushiBarDatabaseImplement/Models/Order.cs +++ b/SushiBar/SushiBarDatabaseImplement/Models/Order.cs @@ -3,29 +3,38 @@ using SushiBarContracts.ViewModels; using SushiBarDataModels.Enums; using SushiBarDataModels.Models; using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; namespace SushiBarDatabaseImplement.Models { - public class Order : IOrderModel + [DataContract] + public class Order : IOrderModel { - public int Id { get; private set; } - [Required] + [DataMember] + public int Id { get; private set; } + [DataMember] + [Required] public int Count { get; set; } - [Required] + [DataMember] + [Required] public double Sum { get; set; } - [Required] + [DataMember] + [Required] public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; - [Required] + [DataMember] + [Required] public DateTime DateCreate { get; set; } = DateTime.Now; - public DateTime? DateImplement { get; set; } - [Required] + [DataMember] + public DateTime? DateImplement { get; set; } + [DataMember] + [Required] public int SushiId { get; private set; } public virtual Sushi Sushi { get; set; } - - public int ClientId { get; private set; } + [DataMember] + public int ClientId { get; private set; } public virtual Client Client { get; private set; } - - public int? ImplementerId { get; private set; } + [DataMember] + public int? ImplementerId { get; private set; } public virtual Implementer? Implementer { get; set; } public static Order Create(SushiBarDatabase context, OrderBindingModel model) @@ -46,6 +55,7 @@ namespace SushiBarDatabaseImplement.Models Sushi = context.Sushis.First(x => x.Id == model.SushiId), ClientId = model.ClientId, Client = context.Clients.First(x => x.Id == model.ClientId), + ImplementerId = model.ImplementerId, Implementer = model.ImplementerId == null ? null : context.Implementers.First(i => i.Id == model.ImplementerId) }; } diff --git a/SushiBar/SushiBarDatabaseImplement/Models/Sushi.cs b/SushiBar/SushiBarDatabaseImplement/Models/Sushi.cs index ea0c130..1429073 100644 --- a/SushiBar/SushiBarDatabaseImplement/Models/Sushi.cs +++ b/SushiBar/SushiBarDatabaseImplement/Models/Sushi.cs @@ -3,18 +3,24 @@ using SushiBarContracts.ViewModels; using SushiBarDataModels.Models; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; namespace SushiBarDatabaseImplement.Models { - public class Sushi : ISushiModel + [DataContract] + public class Sushi : ISushiModel { - public int Id { get; set; } - [Required] + [DataMember] + public int Id { get; set; } + [DataMember] + [Required] public string SushiName { get; set; } = string.Empty; - [Required] + [DataMember] + [Required] public double Price { get; set; } - private Dictionary? _sushiComponents = null; - [NotMapped] + + private Dictionary? _sushiComponents = null; + [NotMapped] public Dictionary SushiComponents { get diff --git a/SushiBar/SushiBarDatabaseImplement/Models/SushiComponent.cs b/SushiBar/SushiBarDatabaseImplement/Models/SushiComponent.cs index e47fdfb..55f06d3 100644 --- a/SushiBar/SushiBarDatabaseImplement/Models/SushiComponent.cs +++ b/SushiBar/SushiBarDatabaseImplement/Models/SushiComponent.cs @@ -1,18 +1,23 @@ using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; namespace SushiBarDatabaseImplement.Models { - public class SushiComponent + [DataContract] + public class SushiComponent { - public int Id { get; set; } - [Required] + [DataMember] + public int Id { get; set; } + [DataMember] + [Required] public int SushiId { get; set; } - [Required] + [DataMember] + [Required] public int ComponentId { get; set; } - [Required] + [DataMember] + [Required] public int Count { get; set; } - public virtual Component Component { get; set; } = new(); + public virtual Component Component { get; set; } = new(); public virtual Sushi Sushi { get; set; } = new(); - } } diff --git a/SushiBar/SushiBarFileImplement/Models/Client.cs b/SushiBar/SushiBarFileImplement/Models/Client.cs index 26bd8e5..87e0228 100644 --- a/SushiBar/SushiBarFileImplement/Models/Client.cs +++ b/SushiBar/SushiBarFileImplement/Models/Client.cs @@ -1,15 +1,21 @@ using SushiBarContracts.BindingModels; using SushiBarContracts.ViewModels; +using System.Runtime.Serialization; using System.Xml.Linq; namespace SushiBarFileImplement.Models { - public class Client + [DataContract] + public class Client { - public int Id { get; private set; } - public string ClientFIO { get; private set; } = string.Empty; - public string Email { get; set; } = string.Empty; - public string Password { get; set; } = string.Empty; + [DataMember] + public int Id { get; private set; } + [DataMember] + public string ClientFIO { get; private set; } = string.Empty; + [DataMember] + public string Email { get; set; } = string.Empty; + [DataMember] + public string Password { get; set; } = string.Empty; public static Client? Create(ClientBindingModel model) { if (model == null) diff --git a/SushiBar/SushiBarFileImplement/Models/Component.cs b/SushiBar/SushiBarFileImplement/Models/Component.cs index 8c4ce84..d4d0b76 100644 --- a/SushiBar/SushiBarFileImplement/Models/Component.cs +++ b/SushiBar/SushiBarFileImplement/Models/Component.cs @@ -1,15 +1,20 @@ using SushiBarContracts.BindingModels; using SushiBarContracts.ViewModels; using SushiBarDataModels.Models; +using System.Runtime.Serialization; using System.Xml.Linq; namespace SushiBarFileImplement.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/SushiBar/SushiBarFileImplement/Models/Implementer.cs b/SushiBar/SushiBarFileImplement/Models/Implementer.cs index 7585909..9e05cd0 100644 --- a/SushiBar/SushiBarFileImplement/Models/Implementer.cs +++ b/SushiBar/SushiBarFileImplement/Models/Implementer.cs @@ -1,17 +1,24 @@ using SushiBarContracts.BindingModels; using SushiBarContracts.ViewModels; using SushiBarDataModels.Models; +using System.Runtime.Serialization; using System.Xml.Linq; namespace SushiBarFileImplement.Models { - internal class Implementer : IImplementerModel + [DataContract] + internal class Implementer : IImplementerModel { - public int Id { get; private set; } - public string ImplementerFIO { get; private set; } = string.Empty; - public string Password { get; set; } = string.Empty; - public int Qualification { get; set; } = 0; - public int WorkExperience { get; set; } = 0; + [DataMember] + public int Id { get; private set; } + [DataMember] + public string ImplementerFIO { get; private set; } = string.Empty; + [DataMember] + public string Password { get; set; } = string.Empty; + [DataMember] + public int Qualification { get; set; } = 0; + [DataMember] + public int WorkExperience { get; set; } = 0; public static Implementer? Create(ImplementerBindingModel model) { if (model == null) diff --git a/SushiBar/SushiBarFileImplement/Models/MessageInfo.cs b/SushiBar/SushiBarFileImplement/Models/MessageInfo.cs index 71e5184..dd164a6 100644 --- a/SushiBar/SushiBarFileImplement/Models/MessageInfo.cs +++ b/SushiBar/SushiBarFileImplement/Models/MessageInfo.cs @@ -1,23 +1,31 @@ using SushiBarContracts.BindingModels; using SushiBarContracts.ViewModels; using SushiBarDataModels.Models; +using System.Runtime.Serialization; using System.Xml.Linq; namespace SushiBarFileImplement.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; - - public string Body { get; private set; } = string.Empty; + [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/SushiBar/SushiBarFileImplement/Models/Order.cs b/SushiBar/SushiBarFileImplement/Models/Order.cs index 31df23d..3c996be 100644 --- a/SushiBar/SushiBarFileImplement/Models/Order.cs +++ b/SushiBar/SushiBarFileImplement/Models/Order.cs @@ -2,21 +2,32 @@ using SushiBarContracts.ViewModels; using SushiBarDataModels.Enums; using SushiBarDataModels.Models; +using System.Runtime.Serialization; using System.Xml.Linq; namespace SushiBarFileImplement.Models { - public class Order : IOrderModel + [DataContract] + public class Order : IOrderModel { - public int Id { get; private set; } - public int SushiId { get; private set; } - public int ClientId { get; private set; } - public int? ImplementerId { get; private set; } - public int Count { get; private set; } - public double Sum { get; private set; } - public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; - public DateTime DateCreate { get; private set; } - public DateTime? DateImplement { get; private set; } + [DataMember] + public int Id { get; private set; } + [DataMember] + public int SushiId { get; private set; } + [DataMember] + public int ClientId { get; private set; } + [DataMember] + public int? ImplementerId { 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; } + [DataMember] + public DateTime? DateImplement { get; private set; } public static Order? Create(OrderBindingModel model) { if (model == null) diff --git a/SushiBar/SushiBarFileImplement/Models/Sushi.cs b/SushiBar/SushiBarFileImplement/Models/Sushi.cs index 5e98c30..db0f606 100644 --- a/SushiBar/SushiBarFileImplement/Models/Sushi.cs +++ b/SushiBar/SushiBarFileImplement/Models/Sushi.cs @@ -1,15 +1,20 @@ using SushiBarContracts.BindingModels; using SushiBarContracts.ViewModels; using SushiBarDataModels.Models; +using System.Runtime.Serialization; using System.Xml.Linq; namespace SushiBarFileImplement.Models { - public class Sushi : ISushiModel + [DataContract] + public class Sushi : ISushiModel { - public int Id { get; private set; } - public string SushiName { get; private set; } = string.Empty; - public double Price { get; private set; } + [DataMember] + public int Id { get; private set; } + [DataMember] + public string SushiName { get; private set; } = string.Empty; + [DataMember] + public double Price { get; private set; } public Dictionary Components { get; private set; } = new(); private Dictionary? _sushiComponents = null; public Dictionary SushiComponents