diff --git a/FlowerShopDataModels/IShopModel.cs b/FlowerShopDataModels/IShopModel.cs new file mode 100644 index 0000000..d5ce4d3 --- /dev/null +++ b/FlowerShopDataModels/IShopModel.cs @@ -0,0 +1,19 @@ +using FlowerShopDataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FlowerShopDataModels.Models +{ + public interface IShopModel : IId + { + string ShopName { get; } + string Address { get; } + DateTime DateOpen { get; } + Dictionary ShopFlowers { get; } + int MaxCapacity { get; } + } +} + diff --git a/FlowerShopDatabaseImplement/Order.cs b/FlowerShopDatabaseImplement/Order.cs index 66b3063..853a9d3 100644 --- a/FlowerShopDatabaseImplement/Order.cs +++ b/FlowerShopDatabaseImplement/Order.cs @@ -11,7 +11,7 @@ using System.Text; using System.Threading.Tasks; using FlowerShopDataModels.Enums; -namespace FlowerShopDatabaseImplement +namespace FlowerShopDatabaseImplement.Models { public class Order : IOrderModel { @@ -27,8 +27,9 @@ namespace FlowerShopDatabaseImplement public DateTime? DateImplement { get; private set; } [Required] public int FlowerId { get; private set; } + public virtual Flower Flower { get; private set; } - public static Order? Create(OrderBindingModel model) + public static Order? Create(FlowerShopDataBase context,OrderBindingModel model) { if (model == null) { @@ -43,6 +44,7 @@ namespace FlowerShopDatabaseImplement DateCreate = model.DateCreate, DateImplement = model.DateImplement, FlowerId = model.FlowerId, + Flower = context.Flowers.FirstOrDefault(x => x.Id == model.FlowerId) }; } @@ -64,6 +66,7 @@ namespace FlowerShopDatabaseImplement Status = Status, DateCreate = DateCreate, DateImplement = DateImplement, + FlowerName = Flower.FlowerName, Id = Id, }; diff --git a/ProjectFlowerShop/FormFlowerComponent.Designer.cs b/ProjectFlowerShop/FormFlowerComponent.Designer.cs index 7f6f9d3..f509bbd 100644 --- a/ProjectFlowerShop/FormFlowerComponent.Designer.cs +++ b/ProjectFlowerShop/FormFlowerComponent.Designer.cs @@ -101,7 +101,7 @@ Controls.Add(labelNumber); Controls.Add(labelComponent); Name = "FormFlowerComponent"; - Text = "Цветок-компонент"; + Text = "Цветы-компоненты"; ResumeLayout(false); PerformLayout(); }