示例#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));
        }