public IHttpActionResult PayBill(PaidBillsMap paidBillsMap) { if (!ModelState.IsValid) { return(BadRequest()); } else { _context.PaidBillsMap.Add(paidBillsMap); _context.SaveChanges(); return(Created(new Uri(Request.RequestUri + "/" + paidBillsMap.PaidBillsMapId), paidBillsMap)); } }
public void UnpayBill(PaidBillsMap paidBillsMap) { var billInDB = _context.PaidBillsMap .SingleOrDefault(b => b.MonthlyBillId == paidBillsMap.MonthlyBillId && b.Month == paidBillsMap.Month && b.Year == paidBillsMap.Year); if (billInDB == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } else { _context.PaidBillsMap.Remove(billInDB); _context.SaveChanges(); } }