public IHttpActionResult PutP1_Group(int id, P1_Group p1_Group) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != p1_Group.U_id) { return(BadRequest()); } db.Entry(p1_Group).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!P1_GroupExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.OK)); }
public IHttpActionResult GetP1_Group(int id) { P1_Group p1_Group = db.P1_Group.Find(id); if (p1_Group == null) { return(NotFound()); } return(Ok(p1_Group)); }
public IHttpActionResult PostP1_Group(P1_Group p1_Group) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.P1_Group.Add(p1_Group); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = p1_Group.G_id }, p1_Group)); }
public IHttpActionResult DeleteP1_Group(int id) { P1_Group p1_Group = db.P1_Group.Find(id); if (p1_Group == null) { return(NotFound()); } db.P1_Group.Remove(p1_Group); db.SaveChanges(); return(Ok(p1_Group)); }