public IHttpActionResult PutCT_Products(int id, CT_Products cT_Products) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != cT_Products.id) { return(BadRequest()); } db.Entry(cT_Products).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CT_ProductsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetCT_Products(int id) { CT_Products cT_Products = db.CT_Products.Find(id); if (cT_Products == null) { return(NotFound()); } return(Ok(cT_Products)); }
public IHttpActionResult PostCT_Products(CT_Products cT_Products) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CT_Products.Add(cT_Products); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = cT_Products.id }, cT_Products)); }
public IHttpActionResult DeleteCT_Products(int id) { CT_Products cT_Products = db.CT_Products.Find(id); if (cT_Products == null) { return(NotFound()); } db.CT_Products.Remove(cT_Products); db.SaveChanges(); return(Ok(cT_Products)); }