// PUT api/AllowedViolationsWorkflow/5 public IHttpActionResult PutAllowedViolationsWorkflow(int id, AllowedViolationsWorkflow allowedviolationsworkflow) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != allowedviolationsworkflow.ID) { return(BadRequest()); } db.Entry(allowedviolationsworkflow).State = EntityState.Modified; try { AllowedViolations allowViolation = db.AllowedViolations.Find(allowedviolationsworkflow.ViolationId); db.Entry(allowViolation).State = EntityState.Modified; allowViolation.Status = allowedviolationsworkflow.Step; db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AllowedViolationsWorkflowExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetAllowedViolationsWorkflow(int id) { AllowedViolationsWorkflow allowedviolationsworkflow = db.AllowedViolationsWorkflows.Find(id); if (allowedviolationsworkflow == null) { return(NotFound()); } return(Ok(allowedviolationsworkflow)); }
public IHttpActionResult PostAllowedViolationsWorkflow(AllowedViolationsWorkflow allowedviolationsworkflow) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.AllowedViolationsWorkflows.Add(allowedviolationsworkflow); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = allowedviolationsworkflow.ID }, allowedviolationsworkflow)); }
public IHttpActionResult DeleteAllowedViolationsWorkflow(int id) { AllowedViolationsWorkflow allowedviolationsworkflow = db.AllowedViolationsWorkflows.Find(id); if (allowedviolationsworkflow == null) { return(NotFound()); } db.AllowedViolationsWorkflows.Remove(allowedviolationsworkflow); db.SaveChanges(); return(Ok(allowedviolationsworkflow)); }