public IHttpActionResult PostNCC_LOAI(NCC_LOAI nCC_LOAI) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NCC_LOAI.Add(nCC_LOAI); try { db.SaveChanges(); } catch (DbUpdateException) { if (NCC_LOAIExists(nCC_LOAI.MA_LOAI_NCC)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = nCC_LOAI.MA_LOAI_NCC }, nCC_LOAI)); }
public IHttpActionResult PutNCC_LOAI(string id, NCC_LOAI nCC_LOAI) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nCC_LOAI.MA_LOAI_NCC) { return(BadRequest()); } db.Entry(nCC_LOAI).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!NCC_LOAIExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetNCC_LOAI(string id) { NCC_LOAI nCC_LOAI = db.NCC_LOAI.Find(id); if (nCC_LOAI == null) { return(NotFound()); } return(Ok(nCC_LOAI)); }
public IHttpActionResult DeleteNCC_LOAI(string id) { NCC_LOAI nCC_LOAI = db.NCC_LOAI.Find(id); if (nCC_LOAI == null) { return(NotFound()); } db.NCC_LOAI.Remove(nCC_LOAI); db.SaveChanges(); return(Ok(nCC_LOAI)); }