public IHttpActionResult PutNotAllowedViolations(int id, NotAllowedViolations notAllowedViolations) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != notAllowedViolations.ID) { return(BadRequest()); } db.Entry(notAllowedViolations).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!NotAllowedViolationsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetNotAllowedViolations(int id) { NotAllowedViolations notAllowedViolations = db.NotAllowedViolations.Find(id); if (notAllowedViolations == null) { return(NotFound()); } return(Ok(notAllowedViolations)); }
public IHttpActionResult PostNotAllowedViolations(NotAllowedViolations notAllowedViolations) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NotAllowedViolations.Add(notAllowedViolations); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = notAllowedViolations.ID }, notAllowedViolations)); }
public IHttpActionResult DeleteNotAllowedViolations(int id) { NotAllowedViolations notAllowedViolations = db.NotAllowedViolations.Find(id); if (notAllowedViolations == null) { return(NotFound()); } db.NotAllowedViolations.Remove(notAllowedViolations); db.SaveChanges(); return(Ok(notAllowedViolations)); }