2024-06-20 22:32:22 +04:00
|
|
|
|
using Contracts.BindingModels;
|
|
|
|
|
using Contracts.ViewModels;
|
|
|
|
|
using DataModels.Models;
|
|
|
|
|
using System;
|
2024-06-11 12:18:10 +04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace DatabaseImplement.Models
|
|
|
|
|
{
|
2024-06-20 22:32:22 +04:00
|
|
|
|
public class Sell : ISell
|
2024-06-11 12:18:10 +04:00
|
|
|
|
{
|
2024-06-20 22:32:22 +04:00
|
|
|
|
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;
|
|
|
|
|
}
|
2024-06-11 12:18:10 +04:00
|
|
|
|
}
|
|
|
|
|
}
|