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)); }
public ActionResult DeleteConfirmed(int id) { HIVMeds hIVMeds = db.HIVMeds.Find(id); db.HIVMeds.Remove(hIVMeds); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
public ActionResult Create([Bind(Include = "id,value")] HIVMeds hIVMeds) { if (ModelState.IsValid) { db.HIVMeds.Add(hIVMeds); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hIVMeds)); }
public IHttpActionResult GetHIVMeds(int id) { HIVMeds hIVMeds = db.HIVMeds.Find(id); if (hIVMeds == null) { return(NotFound()); } return(Ok(hIVMeds)); }
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)); }
// 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)); }
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)); }