// POST: odata/ThongKeCongViecTrongNgays public IHttpActionResult Post(ThongKeCongViecTrongNgay thongKeCongViecTrongNgay) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ThongKeCongViecTrongNgays.Add(thongKeCongViecTrongNgay); db.SaveChanges(); return(Created(thongKeCongViecTrongNgay)); }
// DELETE: odata/ThongKeCongViecTrongNgays(5) public IHttpActionResult Delete([FromODataUri] int key) { ThongKeCongViecTrongNgay thongKeCongViecTrongNgay = db.ThongKeCongViecTrongNgays.Find(key); if (thongKeCongViecTrongNgay == null) { return(NotFound()); } db.ThongKeCongViecTrongNgays.Remove(thongKeCongViecTrongNgay); db.SaveChanges(); return(StatusCode(HttpStatusCode.NoContent)); }
// PUT: odata/ThongKeCongViecTrongNgays(5) public IHttpActionResult Put([FromODataUri] int key, Delta <ThongKeCongViecTrongNgay> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } ThongKeCongViecTrongNgay thongKeCongViecTrongNgay = db.ThongKeCongViecTrongNgays.Find(key); if (thongKeCongViecTrongNgay == null) { return(NotFound()); } patch.Put(thongKeCongViecTrongNgay); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ThongKeCongViecTrongNgayExists(key)) { return(NotFound()); } else { throw; } } return(Updated(thongKeCongViecTrongNgay)); }