public IHttpActionResult PutDM_Ban(int id, DM_Ban dM_Ban) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != dM_Ban.id) { return(BadRequest()); } db.Entry(dM_Ban).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DM_BanExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetDM_Ban(int id) { DM_Ban dM_Ban = db.DM_Ban.Find(id); if (dM_Ban == null) { return(NotFound()); } return(Ok(dM_Ban)); }
public IHttpActionResult PostDM_Ban(DM_Ban dM_Ban) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DM_Ban.Add(dM_Ban); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = dM_Ban.id }, dM_Ban)); }
public IHttpActionResult DeleteDM_Ban(int id) { DM_Ban dM_Ban = db.DM_Ban.Find(id); if (dM_Ban == null) { return(NotFound()); } db.DM_Ban.Remove(dM_Ban); db.SaveChanges(); return(Ok(dM_Ban)); }