Example #1
0
        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));
        }
Example #2
0
        // 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"));
        }
Example #3
0
        // 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"));
        }
Example #4
0
        public IHttpActionResult GetTreatmentDoc(int id)
        {
            TreatmentDoc treatmentDoc = this.db.TreatmentsDocs.Find(id);

            if (treatmentDoc == null)
            {
                return(this.NotFound());
            }

            return(this.Ok(treatmentDoc));
        }
Example #5
0
        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));
        }
Example #6
0
        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"));
        }
Example #7
0
        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));
        }
Example #8
0
        /// <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));
        }