public IHttpActionResult PutTreatmentDoc(int id, TreatmentDoc treatmentDoc) { if (!this.ModelState.IsValid) { return(this.BadRequest(this.ModelState)); } if (id != treatmentDoc.Id) { return(this.BadRequest()); } this.db.Entry(treatmentDoc).State = EntityState.Modified; try { this.db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!this.TreatmentDocExists(id)) { return(this.NotFound()); } throw; } return(this.StatusCode(HttpStatusCode.NoContent)); }
// ReSharper disable once StyleCop.SA1650 public ActionResult Edit([Bind(Include = "Id,TreatmentId,UrlDoc")] TreatmentDoc treatmentDoc) { if (!this.ModelState.IsValid) { return(this.View(treatmentDoc)); } this.db.Entry(treatmentDoc).State = EntityState.Modified; this.db.SaveChanges(); return(this.RedirectToAction("Index")); }
// ReSharper disable once StyleCop.SA1650 public ActionResult Create([Bind(Include = "Id,TreatmentId,UrlDoc")] TreatmentDoc treatmentDoc) { if (!this.ModelState.IsValid) { return(this.View(treatmentDoc)); } this.db.TreatmentsDocs.Add(treatmentDoc); this.db.SaveChanges(); return(this.RedirectToAction("Index")); }
public IHttpActionResult GetTreatmentDoc(int id) { TreatmentDoc treatmentDoc = this.db.TreatmentsDocs.Find(id); if (treatmentDoc == null) { return(this.NotFound()); } return(this.Ok(treatmentDoc)); }
public IHttpActionResult PostTreatmentDoc(TreatmentDoc treatmentDoc) { if (!this.ModelState.IsValid) { return(this.BadRequest(this.ModelState)); } this.db.TreatmentsDocs.Add(treatmentDoc); this.db.SaveChanges(); return(this.CreatedAtRoute("DefaultApi", new { id = treatmentDoc.Id }, treatmentDoc)); }
public ActionResult DeleteConfirmed(int id) { TreatmentDoc treatmentDoc = this.db.TreatmentsDocs.Find(id); if (treatmentDoc == null) { return(this.RedirectToAction("Index")); } this.db.TreatmentsDocs.Remove(treatmentDoc); this.db.SaveChanges(); return(this.RedirectToAction("Index")); }
public IHttpActionResult DeleteTreatmentDoc(int id) { TreatmentDoc treatmentDoc = this.db.TreatmentsDocs.Find(id); if (treatmentDoc == null) { return(this.NotFound()); } this.db.TreatmentsDocs.Remove(treatmentDoc); this.db.SaveChanges(); return(this.Ok(treatmentDoc)); }
/// <summary> /// The details. /// GET: TreatmentDocs/Details/5 /// </summary> /// <param name="id"> /// The id. /// </param> /// <returns> /// The <see cref="ActionResult"/>. /// </returns> public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TreatmentDoc treatmentDoc = this.db.TreatmentsDocs.Find(id); if (treatmentDoc == null) { return(this.HttpNotFound()); } return(this.View(treatmentDoc)); }