예제 #1
0
        public IHttpActionResult PutMedicalOnly(int id, MedicalOnly medicalOnly)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != medicalOnly.MedicalOnlyId)
            {
                return(BadRequest());
            }

            db.Entry(medicalOnly).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MedicalOnlyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutMedicalOnly(int id, MedicalOnly medicalOnly)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != medicalOnly.MedicalOnlyId)
            {
                return BadRequest();
            }

            db.Entry(medicalOnly).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MedicalOnlyExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
예제 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            MedicalOnly medicalOnly = db.MedicalOnly.Find(id);

            db.MedicalOnly.Remove(medicalOnly);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #4
0
 public ActionResult Edit([Bind(Include = "id,value")] MedicalOnly medicalOnly)
 {
     if (ModelState.IsValid)
     {
         db.Entry(medicalOnly).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(medicalOnly));
 }
예제 #5
0
        public ActionResult Create([Bind(Include = "id,value")] MedicalOnly medicalOnly)
        {
            if (ModelState.IsValid)
            {
                db.MedicalOnly.Add(medicalOnly);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(medicalOnly));
        }
예제 #6
0
        public IHttpActionResult GetMedicalOnly(int id)
        {
            MedicalOnly medicalOnly = db.MedicalOnlies.Find(id);

            if (medicalOnly == null)
            {
                return(NotFound());
            }

            return(Ok(medicalOnly));
        }
예제 #7
0
        public IHttpActionResult PostMedicalOnly(MedicalOnly medicalOnly)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MedicalOnlies.Add(medicalOnly);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = medicalOnly.MedicalOnlyId }, medicalOnly));
        }
        public IHttpActionResult PostMedicalOnly(MedicalOnly medicalOnly)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.MedicalOnlies.Add(medicalOnly);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = medicalOnly.MedicalOnlyId }, medicalOnly);
        }
예제 #9
0
        // GET: MedicalOnlies/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MedicalOnly medicalOnly = db.MedicalOnly.Find(id);

            if (medicalOnly == null)
            {
                return(HttpNotFound());
            }
            return(View(medicalOnly));
        }
예제 #10
0
        public IHttpActionResult DeleteMedicalOnly(int id)
        {
            MedicalOnly medicalOnly = db.MedicalOnlies.Find(id);

            if (medicalOnly == null)
            {
                return(NotFound());
            }

            db.MedicalOnlies.Remove(medicalOnly);
            db.SaveChanges();

            return(Ok(medicalOnly));
        }