public async Task <List <Bill> > AllForUserAsync(int userId) { return((await Uow.Bills .AllForUserAsync(userId)) .Select(e => BillMapper .MapFromDAL(e)).ToList()); }
public async Task <List <BillLine> > AllForBillAsync(int?billId) { return((await Uow.BillLines .AllForBillAsync(billId)) .Select(c => new BillLine() { Id = c.Id, BillId = c.BillId, Bill = BillMapper.MapFromDAL(c.Bill), Product = c.Product, Amount = c.Amount, Sum = c.Sum, DiscountPercent = c.DiscountPercent, SumWithDiscount = c.Sum * c.Amount * (1 - c.DiscountPercent / 100) }) .ToList()); }
public override async Task <Bill> FindAsync(params object[] id) { var bill = await Uow.Bills.FindAsync(id); if (bill != null) { var billLines = await Uow.BillLines.AllForBillAsync(bill.Id); bill.SumWithoutTaxes = bill.ArrivalFee; foreach (var billLine in billLines) { bill.SumWithoutTaxes += billLine.SumWithDiscount; } bill.FinalSum = bill.SumWithoutTaxes * 100 / (100 - bill.TaxPercent); } return(BillMapper.MapFromDAL(bill)); // return BillMapper.MapFromDAL(await Uow.Bills.FindAsync(id)); }
public async Task <Bill> FindForUserAsync(int id, int userId) { return(BillMapper.MapFromDAL(await Uow.Bills.FindForUserAsync(id, userId))); }