public ActionResult Edit([Bind(Include = "DoctorID,FirstName,LastName,Email,Phone,Status")] Doctor doctor) { if (ModelState.IsValid) { db.Entry(doctor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(doctor)); }
public ActionResult Edit([Bind(Include = "SID,FirstName,MiddleName,LastName,Phone,Email,Password,Status")] SuperAdmin superAdmin) { if (ModelState.IsValid) { db.Entry(superAdmin).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("DashSuper", "Home")); } return(View(superAdmin)); }
public ActionResult Edit([Bind(Include = "PatientID,FirstName,LastName,DOB,Email,Phone,BloodGroup,Status,Photo,Gender,DoctorID")] Patient patient, FormCollection fc) { //if (ModelState.IsValid) //{ patient.Gender = fc["RbGender"]; db.Entry(patient).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Patients", new { l = 2 })); //} //return View(patient); }
public ActionResult Edit([Bind(Include = "StaffID,FirstName,LastName,Email,Phone,SCategory")] Staff staff, FormCollection fc) { //if (ModelState.IsValid) //{ staff.SCategory = fc["Category"]; db.Entry(staff).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); //} //return View(staff); }
public ActionResult Edit([Bind(Include = "PaymentID,PatientID,PayableAmount,PaymentDate,PaymentMethod,Status")] Payment payment, FormCollection fc) { //if (ModelState.IsValid) //{ payment.PaymentMethod = fc["RbPM"]; payment.Status = fc["RbStatus"]; db.Entry(payment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("PaymentReport", "Payments", new { id = payment.PatientID, l = 3 })); //} //ViewBag.PatientID = new SelectList(db.Patients, "PatientID", "FirstName", payment.PatientID); //return View(payment); }
public virtual TEntity Update(TEntity item, TKey key) { using (var transaction = Context.Database.BeginTransaction()) { try { if (item == null) { return(null); } TEntity exist = Context.Set <TEntity>().Find(key); if (exist != null) { Context.Entry(exist).CurrentValues.SetValues(item); Context.SaveChanges(); transaction.Commit(); } return(exist); } catch (Exception ex) { transaction.Rollback(); throw new Exception(ex.Message); } } }
public ActionResult Edit([Bind(Include = "TreatmentID,PatientID,CheckupDate,Symptoms,Diagnosis,Medicine,Doses,BeforeMeal,Advice")] Treatment treatment, FormCollection fc) { //if (ModelState.IsValid) //{ treatment.Doses = fc["Doses"]; treatment.BeforeMeal = fc["RbBeforeMeal"]; List <Patient> patient = db.Patients.ToList(); var result = patient.Where(x => x.PatientID.Equals(treatment.PatientID)).Select(x => x.DoctorID); var DocId = result.ToList(); db.Entry(treatment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ExistingPatientReport", "Patients", new { id = treatment.PatientID, Did = DocId[0], l = 1 })); //} //ViewBag.PatientID = new SelectList(db.Patients, "PatientID", "FirstName", treatment.PatientID); //return View(treatment); }