59 lines
1.6 KiB
C#
59 lines
1.6 KiB
C#
using DressAtelierContracts.BindingModels;
|
|
using DressAtelierContracts.BusinessLogicContracts;
|
|
using DressAtelierContracts.SearchModels;
|
|
using DressAtelierContracts.ViewModels;
|
|
using DressAtelierDataModels.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DressAtelierListImplement.Models
|
|
{
|
|
public class Dress : IDressModel
|
|
{
|
|
public int ID { get; private set; }
|
|
public string DressName { get; private set; } = string.Empty;
|
|
|
|
public double Price { get; private set; }
|
|
|
|
public Dictionary<int, (IMaterialModel, int)> DressComponents { get; private set; } = new Dictionary<int, (IMaterialModel, int)>();
|
|
|
|
public static Dress? Create(DressBindingModel? model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
return null;
|
|
}
|
|
return new Dress()
|
|
{
|
|
ID = model.ID,
|
|
DressName = model.DressName,
|
|
Price = model.Price,
|
|
DressComponents = model.DressComponents
|
|
};
|
|
|
|
}
|
|
|
|
public void Update(DressBindingModel? model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
return;
|
|
}
|
|
DressName = model.DressName;
|
|
Price = model.Price;
|
|
DressComponents = model.DressComponents;
|
|
}
|
|
public DressViewModel GetViewModel => new()
|
|
{
|
|
ID = ID,
|
|
DressName = DressName,
|
|
Price = Price,
|
|
DressComponents = DressComponents
|
|
};
|
|
|
|
}
|
|
}
|