2024-04-21 19:17:40 +04:00
|
|
|
|
using AccountingWarehouseProductsContracts.BindingModels;
|
|
|
|
|
using AccountingWarehouseProductsContracts.ViewModels;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace AccountingWarehouseProductsDatabaseImplement.Models
|
|
|
|
|
{
|
|
|
|
|
public class Shipment
|
|
|
|
|
{
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
2024-05-01 22:21:11 +04:00
|
|
|
|
public string ShipmentDate { get; set; } = string.Empty;
|
2024-04-21 19:17:40 +04:00
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public int Count { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public string Recipient { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public int OrderId { get; set; }
|
|
|
|
|
|
|
|
|
|
public static Shipment? Create(ShipmentBindingModel model)
|
|
|
|
|
{
|
|
|
|
|
if (model == null) return null;
|
|
|
|
|
|
|
|
|
|
return new Shipment()
|
|
|
|
|
{
|
|
|
|
|
Id = model.Id,
|
|
|
|
|
ShipmentDate = model.ShipmentDate,
|
|
|
|
|
Count = model.Count,
|
|
|
|
|
Recipient = model.Recipient,
|
|
|
|
|
OrderId = model.OrderId
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Update(ShipmentBindingModel model)
|
|
|
|
|
{
|
|
|
|
|
if (model == null) return;
|
|
|
|
|
ShipmentDate = model.ShipmentDate;
|
|
|
|
|
Count = model.Count;
|
|
|
|
|
Recipient = model.Recipient;
|
|
|
|
|
OrderId = model.OrderId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ShipmentViewModel GetViewModel => new()
|
|
|
|
|
{
|
|
|
|
|
Id = Id,
|
|
|
|
|
ShipmentDate = ShipmentDate,
|
|
|
|
|
Count = Count,
|
|
|
|
|
Recipient = Recipient,
|
|
|
|
|
OrderId = OrderId
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|