Update automapper

This commit is contained in:
2016-09-24 00:06:34 -04:00
parent f473c64540
commit 6789c1b3b5
32 changed files with 254 additions and 206 deletions
@@ -12,10 +12,12 @@ namespace InventoryTraker.Web.Services
public class ReportService
{
private readonly AppDbContext _context;
private readonly IMapper _mapper;
public ReportService(AppDbContext context)
public ReportService(AppDbContext context, IMapper mapper)
{
_context = context;
_mapper = mapper;
}
public DistributionReport[] GetDistributionReport(DateTime startDate, DateTime endDate)
@@ -42,7 +44,7 @@ namespace InventoryTraker.Web.Services
Date = item.Date,
Destination = item.Destination,
Transactions =
Mapper.Map<IList<Transaction>, IList<TransactionViewModel>>
_mapper.Map<IList<Transaction>, IList<TransactionViewModel>>
(item.Transactions).ToArray()
};
@@ -149,7 +151,7 @@ namespace InventoryTraker.Web.Services
into grp
select new MovementReportItem
{
InventoryType = Mapper.Map<InventoryTypeViewModel>(grp.Key),
InventoryType = _mapper.Map<InventoryTypeViewModel>(grp.Key),
BeginningQuantity = grp.Sum(g => g.BeginningQuantity),
AddedQuantity = grp.Sum(g => g.AddedQuantity),
TotalAvailableQuantity = grp.Sum(g => g.TotalAvailableQuantity),