AccountingWarehouseProducts.../AccountingWarehouseProducts/AccountingWarehouseProductsDatabaseImplement/Models/Stand.cs

61 lines
1.6 KiB
C#

using AccountingWarehouseProductsContracts.BindingModels;
using AccountingWarehouseProductsContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AccountingWarehouseProductsDatabaseImplement.Models
{
public class Stand
{
public int Id { get; set; }
public string StandName { get; set; } = string.Empty;
public string? DeliveryDate { get; set; } = string.Empty;
public int Count { get; set; }
public int ProductId { get; set; }
public int SupplierId { get; set; }
public static Stand? Create(StandBindingModel model)
{
if (model == null) return null;
return new Stand()
{
Id = model.Id,
StandName = model.StandName,
DeliveryDate = model.DeliveryDate,
Count = model.Count,
ProductId = model.ProductId,
SupplierId = model.SupplierId
};
}
public void Update(StandBindingModel model)
{
if (model == null) return;
StandName = model.StandName;
DeliveryDate = model.DeliveryDate;
Count = model.Count;
ProductId = model.ProductId;
SupplierId = model.SupplierId;
}
public StandViewModel GetViewModel => new()
{
Id = Id,
StandName = StandName,
DeliveryDate = DeliveryDate,
Count = Count,
ProductId = ProductId,
SupplierId = SupplierId
};
}
}