public virtual void Delete(TEntity entityToDelete) { if (context.Entry(entityToDelete).State == EntityState.Detached) { dbSet.Attach(entityToDelete); } dbSet.Remove(entityToDelete); }
public ActionResult Edit([Bind(Include = "DistrictID,DistrictName")] District district) { if (ModelState.IsValid) { db.Entry(district).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(district)); }
public ActionResult Edit([Bind(Include = "DocID,Address,FirstName,LastName,Username,DOB,Email,RegionID,Password,isActive,TariffCode,isOnline")] Doctor doctor) { if (ModelState.IsValid) { db.Entry(doctor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RegionID = new SelectList(db.Regions, "RegionID", "RegionName", doctor.RegionID); return(View(doctor)); }
public ActionResult Edit([Bind(Include = "AdminID,FirstName,LastName,userName,password,DistrictID")] Admin admin) { if (ModelState.IsValid) { db.Entry(admin).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DistrictID = new SelectList(db.Districts, "DistrictID", "DistrictName", admin.DistrictID); return(View(admin)); }
public ActionResult Edit([Bind(Include = "PatientID,FirstName,LastName,Email,Contact,Supervisor,PatientSince")] Patient patient) { if (ModelState.IsValid) { db.Entry(patient).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Supervisor = new SelectList(db.Doctors, "DocID", "Address", patient.Supervisor); return(View(patient)); }
public ActionResult Edit([Bind(Include = "RegionID,RegionName,DistrictID")] Region region) { if (ModelState.IsValid) { db.Entry(region).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DistrictID = new SelectList(db.Districts, "DistrictID", "DistrictName", region.DistrictID); return(View(region)); }