//private ApplicationDbContext _context; //public BillRepository(ApplicationDbContext context) //{ // _context = context; //} public GoldBill CalculateBill(GoldBill bill) { if (bill != null) { float price = bill.GoldPrice * bill.Weight; bill.TotalPrice = price - (price * bill.Discount) / 100; } return(bill); }
public IActionResult GetBill([FromBody] GoldBill bill) { bill = _bill.CalculateBill(bill); return(Ok(bill)); }