PIAPS_CW/DatabaseImplement/Models/Sell.cs
2024-06-20 22:32:22 +04:00

45 lines
922 B
C#

using Contracts.BindingModels;
using Contracts.ViewModels;
using DataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseImplement.Models
{
public class Sell : ISell
{
public Guid Id { get; set; }
public DateTime DateSell { get; set; }
public SellBindingModel GetBindingModel() => new()
{
Id = Id,
DateSell = DateSell
};
public static Sell ToSellFromView(SellViewModel model, Sell sell) => new()
{
Id = model.Id,
DateSell = model.DateSell
};
public static Sell ToSellFromBinding(SellBindingModel model, Sell sell) => new()
{
Id = model.Id,
DateSell = model.DateSell,
};
public void Update(SellBindingModel model, Sell sell)
{
if (model is null)
{
throw new ArgumentNullException("Update user: binding model is null");
}
DateSell = sell.DateSell;
}
}
}