public IHttpActionResult PutConusmable_Type(int id, Conusmable_Type conusmable_Type) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != conusmable_Type.Id) { return(BadRequest()); } db.Entry(conusmable_Type).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Conusmable_TypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetConusmable_Type(int id) { Conusmable_Type conusmable_Type = db.Conusmable_Type.Find(id); if (conusmable_Type == null) { return(NotFound()); } return(Ok(conusmable_Type)); }
public IHttpActionResult PostConusmable_Type(Conusmable_Type conusmable_Type) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Conusmable_Type.Add(conusmable_Type); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = conusmable_Type.Id }, conusmable_Type)); }
public IHttpActionResult DeleteConusmable_Type(int id) { Conusmable_Type conusmable_Type = db.Conusmable_Type.Find(id); if (conusmable_Type == null) { return(NotFound()); } db.Conusmable_Type.Remove(conusmable_Type); db.SaveChanges(); return(Ok(conusmable_Type)); }