public IHttpActionResult PutHWL_Categories(int id, HWL_Categories hWL_Categories) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != hWL_Categories.CategoryId) { return(BadRequest()); } db.Entry(hWL_Categories).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HWL_CategoriesExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetHWL_Categories(int id) { HWL_Categories hWL_Categories = db.HWL_Categories.Find(id); if (hWL_Categories == null) { return(NotFound()); } return(Ok(hWL_Categories)); }
public IHttpActionResult PostHWL_Categories(HWL_Categories hWL_Categories) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.HWL_Categories.Add(hWL_Categories); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = hWL_Categories.CategoryId }, hWL_Categories)); }
public IHttpActionResult DeleteHWL_Categories(int id) { HWL_Categories hWL_Categories = db.HWL_Categories.Find(id); if (hWL_Categories == null) { return(NotFound()); } db.HWL_Categories.Remove(hWL_Categories); db.SaveChanges(); return(Ok(hWL_Categories)); }