public async Task <IHttpActionResult> PutTRN_Number(int id, TRN_Number tRN_Number) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tRN_Number.Id) { return(BadRequest()); } db.Entry(tRN_Number).State = EntityState.Modified; try { await db.SaveChangesAsync(); return(Ok(tRN_Number)); } catch (DbUpdateConcurrencyException) { if (!TRN_NumberExists(id)) { return(NotFound()); } else { throw; } } }
public IHttpActionResult GetTRN_Number(int id) { TRN_Number tRN_Number = db.TRN_Number.Find(id); if (tRN_Number == null) { return(NotFound()); } return(Ok(tRN_Number)); }
public IHttpActionResult DeleteTRN_Number(int id) { TRN_Number tRN_Number = db.TRN_Number.Find(id); if (tRN_Number == null) { return(NotFound()); } db.TRN_Number.Remove(tRN_Number); db.SaveChanges(); return(Ok(tRN_Number)); }
public async Task <IHttpActionResult> PostTRN_Number(TRN_Number tRN_Number) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Entry(tRN_Number).State = EntityState.Modified; try { await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = tRN_Number.Id }, tRN_Number)); } catch (DbUpdateConcurrencyException) { return(BadRequest(ModelState)); } }