public IHttpActionResult PostKM_file(KM_file kM_file) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } kM_file.FlowId = Guid.NewGuid(); db.KM_file.Add(kM_file); try { db.SaveChanges(); } catch (DbUpdateException) { if (KM_fileExists(kM_file.FlowId)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = kM_file.FlowId }, kM_file)); }
public IHttpActionResult PutKM_file(Guid id, KM_file kM_file) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != kM_file.FlowId) { return(BadRequest()); } db.Entry(kM_file).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!KM_fileExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetKM_file(Guid id) { KM_file kM_file = db.KM_file.Find(id); if (kM_file == null) { return(NotFound()); } return(Ok(kM_file)); }
public IHttpActionResult DeleteKM_file(Guid id) { KM_file kM_file = db.KM_file.Find(id); if (kM_file == null) { return(NotFound()); } db.KM_file.Remove(kM_file); db.SaveChanges(); return(Ok(kM_file)); }