public async Task <IHttpActionResult> PostBillerService(BillerService billerService) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.BillerServices.Add(billerService); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (BillerServiceExists(billerService.BillerID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = billerService.BillerID }, billerService)); }
public async Task <IHttpActionResult> PutBillerService(Guid id, BillerService billerService) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != billerService.BillerID) { return(BadRequest()); } db.Entry(billerService).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BillerServiceExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetBillerService(Guid id) { BillerService billerService = await db.BillerServices.FindAsync(id); if (billerService == null) { return(NotFound()); } return(Ok(billerService)); }
public async Task <IHttpActionResult> DeleteBillerService(Guid id) { BillerService billerService = await db.BillerServices.FindAsync(id); if (billerService == null) { return(NotFound()); } db.BillerServices.Remove(billerService); await db.SaveChangesAsync(); return(Ok(billerService)); }