Update automapper
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user