PIAPS_CW/Contracts/Converters/PurchaseConverter.cs

30 lines
695 B
C#

using Contracts.BindingModels;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.Converters
{
public class PurchaseConverter
{
public static PurchaseViewModel ToView(PurchaseBindingModel model) => new()
{
Id = model.Id,
DatePurchase = model.DatePurchase,
UserId = model.UserId,
PurchaseProducts = model.PurchaseProducts,
};
public static PurchaseBindingModel ToBinding(PurchaseViewModel model) => new()
{
Id = model.Id,
DatePurchase = model.DatePurchase,
UserId = model.UserId,
PurchaseProducts = model.PurchaseProducts,
};
}
}