public IHttpActionResult PutDeanGroup(decimal id, DeanGroup deanGroup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != deanGroup.group_id) { return(BadRequest()); } db.Entry(deanGroup).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DeanGroupExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetDeanGroup(decimal id) { DeanGroup deanGroup = db.DeanGroup.Find(id); if (deanGroup == null) { return(NotFound()); } return(Ok(deanGroup)); }
public IHttpActionResult PostDeanGroup(DeanGroup deanGroup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DeanGroup.Add(deanGroup); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = deanGroup.group_id }, deanGroup)); }
public IHttpActionResult DeleteDeanGroup(decimal id) { DeanGroup deanGroup = db.DeanGroup.Find(id); if (deanGroup == null) { return(NotFound()); } db.DeanGroup.Remove(deanGroup); db.SaveChanges(); return(Ok(deanGroup)); }