public ActionResult Create(TreatmentPlaceViewModel model) { string username = User.Identity.Name; string userid = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? ""; JohaMeriSQL1Entities db = new JohaMeriSQL1Entities(); TreatmentPlace trp = new TreatmentPlace(); trp.TreatmentPlaceName = model.TreatmentPlaceName; trp.TreatmentPlaceNumber = model.TreatmentPlaceNumber; db.TreatmentPlace.Add(trp); try { db.SaveChanges(); } catch (Exception ex) { } return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { TreatmentPlace treatmentPlace = db.TreatmentPlace.Find(id); db.TreatmentPlace.Remove(treatmentPlace); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(TreatmentPlaceViewModel model) { TreatmentPlace treatplace = db.TreatmentPlace.Find(model.TreatmentPlace_id); treatplace.TreatmentPlaceName = model.TreatmentPlaceName; treatplace.TreatmentPlaceNumber = model.TreatmentPlaceNumber; db.SaveChanges(); return(RedirectToAction("Index")); }//edit
public ActionResult DeleteConfirmed(int id) { string username = User.Identity.Name; string userid = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? ""; TreatmentPlace treatmentPlace = db.TreatmentPlace.Find(id); db.TreatmentPlace.Remove(treatmentPlace); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(TreatmentPlaceViewModel model) { string username = User.Identity.Name; string userid = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? ""; TreatmentPlace treatplace = db.TreatmentPlace.Find(model.TreatmentPlace_id); treatplace.TreatmentPlaceName = model.TreatmentPlaceName; treatplace.TreatmentPlaceNumber = model.TreatmentPlaceNumber; db.SaveChanges(); return(RedirectToAction("Index")); }//edit
}//edit // GET: TreatmentPlaces/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TreatmentPlace treatmentPlace = db.TreatmentPlace.Find(id); if (treatmentPlace == null) { return(HttpNotFound()); } TreatmentPlaceViewModel view = new TreatmentPlaceViewModel(); view.TreatmentPlace_id = treatmentPlace.TreatmentPlace_id; view.TreatmentPlaceName = treatmentPlace.TreatmentPlaceName; view.TreatmentPlaceNumber = treatmentPlace.TreatmentPlaceNumber; return(View(view)); }//Delete
// GET: TreatmentPlaces/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TreatmentPlace treatmentPlace = db.TreatmentPlace.Find(id); if (treatmentPlace == null) { return(HttpNotFound()); } TreatmentPlaceViewModel treatplace = new TreatmentPlaceViewModel(); treatplace.TreatmentPlace_id = treatmentPlace.TreatmentPlace_id; treatplace.TreatmentPlaceName = treatmentPlace.TreatmentPlaceName; treatplace.TreatmentPlaceNumber = treatmentPlace.TreatmentPlaceNumber; return(View(treatplace)); }
public ActionResult Create(TreatmentPlaceViewModel model) { JohaMeriSQL1Entities db = new JohaMeriSQL1Entities(); TreatmentPlace trp = new TreatmentPlace(); trp.TreatmentPlaceName = model.TreatmentPlaceName; trp.TreatmentPlaceNumber = model.TreatmentPlaceNumber; db.TreatmentPlace.Add(trp); try { db.SaveChanges(); } catch (Exception ex) { } return(RedirectToAction("Index")); }
}//edit // GET: TreatmentPlaces/Delete/5 public ActionResult Delete(int?id) { string username = User.Identity.Name; string userid = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? ""; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TreatmentPlace treatmentPlace = db.TreatmentPlace.Find(id); if (treatmentPlace == null) { return(HttpNotFound()); } TreatmentPlaceViewModel view = new TreatmentPlaceViewModel(); view.TreatmentPlace_id = treatmentPlace.TreatmentPlace_id; view.TreatmentPlaceName = treatmentPlace.TreatmentPlaceName; view.TreatmentPlaceNumber = treatmentPlace.TreatmentPlaceNumber; return(View(view)); }//Delete