public IHttpActionResult PutORDER_HoaDonBanHang(int id, ORDER_HoaDonBanHang oRDER_HoaDonBanHang) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != oRDER_HoaDonBanHang.id) { return(BadRequest()); } db.Entry(oRDER_HoaDonBanHang).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ORDER_HoaDonBanHangExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetORDER_HoaDonBanHang(int id) { ORDER_HoaDonBanHang oRDER_HoaDonBanHang = db.ORDER_HoaDonBanHang.Find(id); if (oRDER_HoaDonBanHang == null) { return(NotFound()); } return(Ok(oRDER_HoaDonBanHang)); }
public IHttpActionResult PostORDER_HoaDonBanHang(ORDER_HoaDonBanHang oRDER_HoaDonBanHang) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ORDER_HoaDonBanHang.Add(oRDER_HoaDonBanHang); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = oRDER_HoaDonBanHang.id }, oRDER_HoaDonBanHang)); }
public IHttpActionResult DeleteORDER_HoaDonBanHang(int id) { ORDER_HoaDonBanHang oRDER_HoaDonBanHang = db.ORDER_HoaDonBanHang.Find(id); if (oRDER_HoaDonBanHang == null) { return(NotFound()); } db.ORDER_HoaDonBanHang.Remove(oRDER_HoaDonBanHang); db.SaveChanges(); return(Ok(oRDER_HoaDonBanHang)); }