Пример #1
0
        public IHttpActionResult PutHIVMeds(int id, HIVMeds hIVMeds)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != hIVMeds.HIVMedsId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            HIVMeds hIVMeds = db.HIVMeds.Find(id);

            db.HIVMeds.Remove(hIVMeds);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #3
0
 public ActionResult Edit([Bind(Include = "id,value")] HIVMeds hIVMeds)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hIVMeds).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(hIVMeds));
 }
Пример #4
0
        public ActionResult Create([Bind(Include = "id,value")] HIVMeds hIVMeds)
        {
            if (ModelState.IsValid)
            {
                db.HIVMeds.Add(hIVMeds);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(hIVMeds));
        }
Пример #5
0
        public IHttpActionResult GetHIVMeds(int id)
        {
            HIVMeds hIVMeds = db.HIVMeds.Find(id);

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

            return(Ok(hIVMeds));
        }
Пример #6
0
        public IHttpActionResult PostHIVMeds(HIVMeds hIVMeds)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.HIVMeds.Add(hIVMeds);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = hIVMeds.HIVMedsId }, hIVMeds));
        }
Пример #7
0
        // GET: HIVMeds/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HIVMeds hIVMeds = db.HIVMeds.Find(id);

            if (hIVMeds == null)
            {
                return(HttpNotFound());
            }
            return(View(hIVMeds));
        }
Пример #8
0
        public IHttpActionResult DeleteHIVMeds(int id)
        {
            HIVMeds hIVMeds = db.HIVMeds.Find(id);

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

            db.HIVMeds.Remove(hIVMeds);
            db.SaveChanges();

            return(Ok(hIVMeds));
        }