public async Task <IHttpActionResult> PostTbl_BillChuyenNhanKho(Tbl_BillChuyenNhanKho tbl_BillChuyenNhanKho) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Tbl_BillChuyenNhanKho.Add(tbl_BillChuyenNhanKho); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (Tbl_BillChuyenNhanKhoExists(tbl_BillChuyenNhanKho.BCNK_ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = tbl_BillChuyenNhanKho.BCNK_ID }, tbl_BillChuyenNhanKho)); }
public async Task <IHttpActionResult> PutTbl_BillChuyenNhanKho(string id, Tbl_BillChuyenNhanKho tbl_BillChuyenNhanKho) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tbl_BillChuyenNhanKho.BCNK_ID) { return(BadRequest()); } db.Entry(tbl_BillChuyenNhanKho).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Tbl_BillChuyenNhanKhoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetTbl_BillChuyenNhanKho(string id) { Tbl_BillChuyenNhanKho tbl_BillChuyenNhanKho = await db.Tbl_BillChuyenNhanKho.FindAsync(id); if (tbl_BillChuyenNhanKho == null) { return(NotFound()); } return(Ok(tbl_BillChuyenNhanKho)); }
public async Task <IHttpActionResult> DeleteTbl_BillChuyenNhanKho(string id) { Tbl_BillChuyenNhanKho tbl_BillChuyenNhanKho = await db.Tbl_BillChuyenNhanKho.FindAsync(id); if (tbl_BillChuyenNhanKho == null) { return(NotFound()); } db.Tbl_BillChuyenNhanKho.Remove(tbl_BillChuyenNhanKho); await db.SaveChangesAsync(); return(Ok(tbl_BillChuyenNhanKho)); }