public async Task <IHttpActionResult> Posttbl_ChitietSupChamDiem(tbl_ChitietSupChamDiem tbl_ChitietSupChamDiem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tbl_ChitietSupChamDiem.Add(tbl_ChitietSupChamDiem); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (tbl_ChitietSupChamDiemExists(tbl_ChitietSupChamDiem.ChitietSupChamDiem_ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = tbl_ChitietSupChamDiem.ChitietSupChamDiem_ID }, tbl_ChitietSupChamDiem)); }
public async Task <IHttpActionResult> Puttbl_ChitietSupChamDiem(string id, tbl_ChitietSupChamDiem tbl_ChitietSupChamDiem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tbl_ChitietSupChamDiem.ChitietSupChamDiem_ID) { return(BadRequest()); } db.Entry(tbl_ChitietSupChamDiem).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!tbl_ChitietSupChamDiemExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> Gettbl_ChitietSupChamDiem(string id) { tbl_ChitietSupChamDiem tbl_ChitietSupChamDiem = await db.tbl_ChitietSupChamDiem.FindAsync(id); if (tbl_ChitietSupChamDiem == null) { return(NotFound()); } return(Ok(tbl_ChitietSupChamDiem)); }
public async Task <IHttpActionResult> Deletetbl_ChitietSupChamDiem(string id) { tbl_ChitietSupChamDiem tbl_ChitietSupChamDiem = await db.tbl_ChitietSupChamDiem.FindAsync(id); if (tbl_ChitietSupChamDiem == null) { return(NotFound()); } db.tbl_ChitietSupChamDiem.Remove(tbl_ChitietSupChamDiem); await db.SaveChangesAsync(); return(Ok(tbl_ChitietSupChamDiem)); }