public IHttpActionResult PutBill(int id, BillModel bill) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bill.Id) { return(BadRequest()); } BillModel updatedBill = billService.PutBill(id, bill); if (updatedBill == null) { return(NotFound()); } if (updatedBill.PaymentMade == true) { voucherService.PostVoucher(updatedBill); } if (updatedBill.PaymentCanceled) { offerService.PutOffer(updatedBill.Offer, false); } return(Ok(updatedBill)); }