This commit is contained in:
antoc0der 2024-03-24 21:00:11 +04:00
parent a7eaf9241b
commit ec23419300
3 changed files with 25 additions and 3 deletions

View File

@ -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<int, (IFlowerModel, int)> ShopFlowers { get; }
int MaxCapacity { get; }
}
}

View File

@ -11,7 +11,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using FlowerShopDataModels.Enums; using FlowerShopDataModels.Enums;
namespace FlowerShopDatabaseImplement namespace FlowerShopDatabaseImplement.Models
{ {
public class Order : IOrderModel public class Order : IOrderModel
{ {
@ -27,8 +27,9 @@ namespace FlowerShopDatabaseImplement
public DateTime? DateImplement { get; private set; } public DateTime? DateImplement { get; private set; }
[Required] [Required]
public int FlowerId { get; private set; } 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) if (model == null)
{ {
@ -43,6 +44,7 @@ namespace FlowerShopDatabaseImplement
DateCreate = model.DateCreate, DateCreate = model.DateCreate,
DateImplement = model.DateImplement, DateImplement = model.DateImplement,
FlowerId = model.FlowerId, FlowerId = model.FlowerId,
Flower = context.Flowers.FirstOrDefault(x => x.Id == model.FlowerId)
}; };
} }
@ -64,6 +66,7 @@ namespace FlowerShopDatabaseImplement
Status = Status, Status = Status,
DateCreate = DateCreate, DateCreate = DateCreate,
DateImplement = DateImplement, DateImplement = DateImplement,
FlowerName = Flower.FlowerName,
Id = Id, Id = Id,
}; };

View File

@ -101,7 +101,7 @@
Controls.Add(labelNumber); Controls.Add(labelNumber);
Controls.Add(labelComponent); Controls.Add(labelComponent);
Name = "FormFlowerComponent"; Name = "FormFlowerComponent";
Text = "Цветок-компонент"; Text = "Цветы-компоненты";
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }