示例#1
0
        public async Task <ActionResult <List <Bill> > > Post(
            [FromServices] DataContext context,
            [FromBody] Pdv model)
        {
            BillRepository billRepository = new BillRepository(context);
            decimal        change         = model.AmountPaid - model.Price;

            //Change limit
            if (change >= 10000)
            {
                return(null);
            }

            context.Pdvs.Add(model);

            List <Bill> lBills = billRepository.CalculateChange(model);

            //context.Bills.UpdateRange(lBills);

            context.SaveChanges();

            return(lBills);
        }