public ActionResult Edit(int id) { MembershipUser _getCurrentUser = Membership.GetUser(); DoctorModel _getmodel = new DoctorModel(); if (_getCurrentUser != null) { bool IsRole = Roles.IsUserInRole("Admin"); if (IsRole) { Guid _adminkey = (Guid)_getCurrentUser.ProviderUserKey; DoctorManage _profile = DoctorManage.EditUser(id, _adminkey); if (_profile != null) { _getmodel.UserName = _profile.UserName; _getmodel.Email = _profile.Email; _getmodel.Name = _profile.Name; _getmodel.PhoneNumber = _profile.PhoneNumber; _getmodel.DDOB = _profile.DDOB; _getmodel.Address1 = _profile.Address1; _getmodel.Address2 = _profile.Address2; _getmodel.Practice = _profile.Practice; } return(View(_getmodel)); } } return(RedirectToAction("Index", "Patient")); }
public ActionResult Edit([Bind(Include = "DrId,DrName,DrPassword,Specialzaition,DrEmail,DrContactNumber,DrExperience,DrGender,IsActive,Cretedby,Modifiedby,Creteddate,Modifieddate")] DoctorManage doctorManage) { if (ModelState.IsValid) { try { var ModifiedName = Convert.ToString(Session["AdminName"]); doctorManage.Modifiedby = ModifiedName; if (Session["DrId"] == null) { doctorManage.IsActive = false; } else if (Session["DrId"] != null) { doctorManage.IsActive = true; } doctorManage.Modifieddate = DateTime.Now; db.Entry(doctorManage).State = EntityState.Modified; db.SaveChanges(); TempData["msg"] = "Doctor Details Updated!!"; return(RedirectToAction("Index")); } catch (Exception ex) { TempData["err"] = ex.Message; } } return(View(doctorManage)); }
public ActionResult DoctorList() { MembershipUser _getCurrentUser = Membership.GetUser(); if (_getCurrentUser != null) { bool IsRole = Roles.IsUserInRole("Admin"); if (IsRole) { Guid _getUserkey = (Guid)_getCurrentUser.ProviderUserKey; List <DoctorProfile> _profile = DoctorManage.GetDoctorList(_getUserkey); return(View(_profile)); } else { return(RedirectToAction("Index", "Patient")); } } else { return(RedirectToAction("Index", "Patient")); } return(RedirectToAction("Index", "Patient")); }
public ActionResult AddDoctor(DoctorModel _pmodel) { MembershipUser _getCurrentUser = Membership.GetUser(); Guid getuserkey = (Guid)_getCurrentUser.ProviderUserKey; DoctorManage _newuser = new DoctorManage() { Name = _pmodel.Name, UserName = _pmodel.UserName, Password = _pmodel.Password, Address1 = _pmodel.Address1, Address2 = _pmodel.Address2, DDOB = _pmodel.DDOB, Email = _pmodel.Email, PhoneNumber = _pmodel.PhoneNumber, Practice=_pmodel.Practice }; string msg = DoctorManage.RegisterDoctor(_newuser, getuserkey); if (msg == "Success") return RedirectToAction("DoctorList", "Doctor"); else return View(_pmodel); return View(); }
// GET: Admin/DoctorManages/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(RedirectToAction("Error", "Dashboard", new { err = "Id is not Avalible!!" })); } DoctorManage doctorManage = db.DoctorManages.Find(id); if (doctorManage == null) { return(RedirectToAction("Error", "Dashboard", new { err = "Data is not Avalible!!" })); } return(View(doctorManage)); }
public ActionResult DeleteConfirmed(int id) { try { DoctorManage doctorManage = db.DoctorManages.Find(id); db.DoctorManages.Remove(doctorManage); db.SaveChanges(); TempData["msg"] = "Doctor Details Deleted!!"; } catch (Exception ex) { TempData["err"] = ex.Message; } return(RedirectToAction("Index")); }
public ActionResult Profile(DoctorModel _user) { MembershipUser _getCurrentUser = Membership.GetUser(); if (_getCurrentUser.Email != _user.Email) { _getCurrentUser.Email = _user.Email; Membership.UpdateUser(_getCurrentUser); } DoctorManage _updateUser = new DoctorManage { Name = _user.Name, DDOB = _user.DDOB, Address1 = _user.Address1, Address2 = _user.Address2, PhoneNumber = _user.PhoneNumber, Practice = _user.Practice }; Guid _getkey = (Guid)_getCurrentUser.ProviderUserKey; string msg = DoctorManage.UpdateUser(_updateUser, _getkey); return(View(_user)); }
public ActionResult AddDoctor(DoctorModel _pmodel) { MembershipUser _getCurrentUser = Membership.GetUser(); Guid getuserkey = (Guid)_getCurrentUser.ProviderUserKey; DoctorManage _newuser = new DoctorManage() { Name = _pmodel.Name, UserName = _pmodel.UserName, Password = _pmodel.Password, Address1 = _pmodel.Address1, Address2 = _pmodel.Address2, DDOB = _pmodel.DDOB, Email = _pmodel.Email, PhoneNumber = _pmodel.PhoneNumber, Practice = _pmodel.Practice }; string msg = DoctorManage.RegisterDoctor(_newuser, getuserkey); if (msg == "Success") { return(RedirectToAction("DoctorList", "Doctor")); } else { return(View(_pmodel)); } return(View()); }
public ActionResult Create([Bind(Include = "DrId,DrName,DrPassword,Specialzaition,DrEmail,DrContactNumber,DrExperience,DrGender,IsActive,Cretedby,Modifiedby,Creteddate,Modifieddate")] DoctorManage doctorManage) { if (ModelState.IsValid) { try { var CretedName = Convert.ToString(Session["AdminName"]); doctorManage.Cretedby = CretedName; doctorManage.Creteddate = DateTime.Now; db.DoctorManages.Add(doctorManage); db.SaveChanges(); TempData["msg"] = "Doctor Details Saved!!"; return(RedirectToAction("Index")); } catch (Exception ex) { TempData["err"] = ex.Message; } } return(View(doctorManage)); }
public ActionResult Drlogin(DoctorManage doctorManage) { try { var login = db.DoctorManages.SingleOrDefault(a => a.DrEmail == doctorManage.DrEmail && a.DrPassword == doctorManage.DrPassword); if (login != null) { Session["DrId"] = doctorManage.DrId; Session["DrName"] = doctorManage.DrName; return(RedirectToAction("Index", "DrIndex")); } else { TempData["err"] = "User name or Password is wrong!!"; } } catch (Exception ex) { TempData["err"] = ex.Message; } return(View()); }
public ActionResult Profile(DoctorModel _user) { MembershipUser _getCurrentUser = Membership.GetUser(); if (_getCurrentUser.Email != _user.Email) { _getCurrentUser.Email = _user.Email; Membership.UpdateUser(_getCurrentUser); } DoctorManage _updateUser = new DoctorManage { Name = _user.Name, DDOB = _user.DDOB, Address1 = _user.Address1, Address2 = _user.Address2, PhoneNumber = _user.PhoneNumber, Practice=_user.Practice }; Guid _getkey = (Guid)_getCurrentUser.ProviderUserKey; string msg = DoctorManage.UpdateUser(_updateUser, _getkey); return View(_user); }