Exemple #1
0
 public async Task <List <Bill> > AllForUserAsync(int userId)
 {
     return((await Uow.Bills
             .AllForUserAsync(userId))
            .Select(e => BillMapper
                    .MapFromDAL(e)).ToList());
 }
Exemple #2
0
 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());
 }
Exemple #3
0
        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));
        }
Exemple #4
0
 public async Task <Bill> FindForUserAsync(int id, int userId)
 {
     return(BillMapper.MapFromDAL(await Uow.Bills.FindForUserAsync(id, userId)));
 }