Intial
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using AutoMapper;
|
||||
using Heroic.AutoMapper;
|
||||
using InventoryTraker.Web.Core;
|
||||
|
||||
namespace InventoryTraker.Web.Models
|
||||
{
|
||||
public class InventoryViewModel : IMapFrom<Inventory>, IHaveCustomMappings
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public int UnitsPerCase { get; set; }
|
||||
|
||||
public string ContainerType { get; set; }
|
||||
|
||||
public double WeightPerCase { get; set; }
|
||||
|
||||
public decimal PricePerCase { get; set; }
|
||||
|
||||
public int Quantity { get; set; }
|
||||
|
||||
public DateTime ExpirationDate { get; set; }
|
||||
|
||||
public void CreateMappings(IMapperConfiguration configuration)
|
||||
{
|
||||
configuration.CreateMap<Inventory, InventoryViewModel>()
|
||||
.ForMember(d => d.Name, opt => opt.MapFrom(s => s.InventoryType.Name))
|
||||
.ForMember(d => d.UnitsPerCase, opt => opt.MapFrom(s => s.InventoryType.UnitsPerCase))
|
||||
.ForMember(d => d.ContainerType, opt => opt.MapFrom(s => s.InventoryType.ContainerType))
|
||||
.ForMember(d => d.WeightPerCase, opt => opt.MapFrom(s => s.InventoryType.WeightPerCase))
|
||||
.ForMember(d => d.PricePerCase, opt => opt.MapFrom(s => s.InventoryType.PricePerCase));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user