public IHttpActionResult Posttbl_DetailBaoCaoHinhAnh(tbl_DetailBaoCaoHinhAnh tbl_DetailBaoCaoHinhAnh) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tbl_DetailBaoCaoHinhAnh.Add(tbl_DetailBaoCaoHinhAnh); try { db.SaveChanges(); } catch (DbUpdateException) { if (tbl_DetailBaoCaoHinhAnhExists(tbl_DetailBaoCaoHinhAnh.BCHA_ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = tbl_DetailBaoCaoHinhAnh.BCHA_ID }, tbl_DetailBaoCaoHinhAnh)); }
public IHttpActionResult Puttbl_DetailBaoCaoHinhAnh(string id, tbl_DetailBaoCaoHinhAnh tbl_DetailBaoCaoHinhAnh) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tbl_DetailBaoCaoHinhAnh.BCHA_ID) { return(BadRequest()); } db.Entry(tbl_DetailBaoCaoHinhAnh).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tbl_DetailBaoCaoHinhAnhExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Gettbl_DetailBaoCaoHinhAnh(string id) { tbl_DetailBaoCaoHinhAnh tbl_DetailBaoCaoHinhAnh = db.tbl_DetailBaoCaoHinhAnh.Find(id); if (tbl_DetailBaoCaoHinhAnh == null) { return(NotFound()); } return(Ok(tbl_DetailBaoCaoHinhAnh)); }
public IHttpActionResult Deletetbl_DetailBaoCaoHinhAnh(string id) { tbl_DetailBaoCaoHinhAnh tbl_DetailBaoCaoHinhAnh = db.tbl_DetailBaoCaoHinhAnh.Find(id); if (tbl_DetailBaoCaoHinhAnh == null) { return(NotFound()); } db.tbl_DetailBaoCaoHinhAnh.Remove(tbl_DetailBaoCaoHinhAnh); db.SaveChanges(); return(Ok(tbl_DetailBaoCaoHinhAnh)); }