COP_Petrushin_PIbd-32/Laba3/ViewModels/ProductTableItem.cs
2024-11-12 10:38:35 +04:00

28 lines
804 B
C#

using Data.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace View.ViewModels
{
public class ProductTableItem
{
public string Id { get; set; }
public string Name { get; set; }
public string ManufacturerName { get; set; }
public string DeliveryDate { get; set; }
public static List<ProductTableItem> ConvertProductsToTableItems(List<Product> products)
{
return products.Select(p => new ProductTableItem
{
Id = p.Id.ToString(),
Name = p.Name,
ManufacturerName = p.ManufacturerName,
DeliveryDate = p.DeliveryDate.ToShortDateString()
}).ToList();
}
}
}