public IHttpActionResult Putviolationcas(int id, violationcas violationcas) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != violationcas.ID) { return(BadRequest()); } db.Entry(violationcas).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!violationcasExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getviolationcas(int id) { violationcas violationcas = db.violationcases.Find(id); if (violationcas == null) { return(NotFound()); } return(Ok(violationcas)); }
public IHttpActionResult Postviolationcas(violationcas violationcas) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.violationcases.Add(violationcas); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = violationcas.ID }, violationcas)); }
public IHttpActionResult Deleteviolationcas(int id) { violationcas violationcas = db.violationcases.Find(id); if (violationcas == null) { return(NotFound()); } db.violationcases.Remove(violationcas); db.SaveChanges(); return(Ok(violationcas)); }