public ActionResult Edit(int id)
        {
            MembershipUser _getCurrentUser = Membership.GetUser();
            PatientModel   _getmodel       = new PatientModel();

            if (_getCurrentUser != null)
            {
                bool IsRole = Roles.IsUserInRole("Doctor");
                if (IsRole)
                {
                    Guid         _doctorkey = (Guid)_getCurrentUser.ProviderUserKey;
                    Registeruser _profile   = PatientManage.EditUser(id, _doctorkey);
                    if (_profile != null)
                    {
                        _getmodel.UserName          = _profile.UserName;
                        _getmodel.Email             = _profile.Email;
                        _getmodel.Name              = _profile.Name;
                        _getmodel.MedicalHistory    = _profile.MedicalHistory;
                        _getmodel.PatientHistorical = _profile.PatientHistorical;
                        _getmodel.PersonalMotivator = _profile.PersonalMotivator;
                        _getmodel.PhoneNumber       = _profile.PhoneNumber;
                        _getmodel.DOB      = _profile.DOB;
                        _getmodel.Address1 = _profile.Address1;
                        _getmodel.Address2 = _profile.Address2;
                    }

                    return(View(_getmodel));
                }
            }

            return(RedirectToAction("Index", "Patient"));
        }
        public ActionResult Registration(string id)
        {
            PatientModel _getregmodel = new PatientModel();

            if (!string.IsNullOrEmpty(id))
            {
                Guid         getid     = new Guid(id);
                Registeruser _getpinfo = PatientManage.patientInfobyregid(getid);
                if (_getpinfo != null)
                {
                    _getregmodel.doctorkey   = _getpinfo.DoctorKey;
                    _getregmodel.Email       = _getpinfo.Email;
                    _getregmodel.Name        = _getpinfo.Name;
                    _getregmodel.PhoneNumber = _getpinfo.PhoneNumber;
                    _getregmodel.DOB         = _getpinfo.DOB;
                    _getregmodel.Address1    = _getpinfo.Address1;
                    _getregmodel.Address2    = _getpinfo.Address2;
                }
                else
                {
                    ViewBag.result = "Invitation code has been suspended!";
                }
            }
            else
            {
                return(RedirectToAction("Index", "Patient"));
            }
            return(View(_getregmodel));
        }
        public ActionResult Registration(PatientModel _pmodel)
        {
            Guid getuserkey = (Guid)_pmodel.doctorkey;

            if (getuserkey != default(Guid))
            {
                Registeruser _newuser = new Registeruser()
                {
                    Name = _pmodel.Name, UserName = _pmodel.UserName, Password = _pmodel.Password, Address1 = _pmodel.Address1, Address2 = _pmodel.Address2, DOB = _pmodel.DOB, Email = _pmodel.Email, MedicalHistory = _pmodel.MedicalHistory, PatientHistorical = _pmodel.PatientHistorical, PhoneNumber = _pmodel.PhoneNumber, PersonalMotivator = _pmodel.PersonalMotivator
                };
                string msg = Registeruser.RegisterPatient(_newuser, getuserkey);
                ViewBag.result = msg;
            }
            else
            {
                ViewBag.result = "Error, invitation code has been suspended!";
            }
            return(View(_pmodel));
        }
        public ActionResult Profile(PatientModel _user)
        {
            MembershipUser _getCurrentUser = Membership.GetUser();

            if (_getCurrentUser.Email != _user.Email)
            {
                _getCurrentUser.Email = _user.Email;
                Membership.UpdateUser(_getCurrentUser);
            }

            Registeruser _updateUser = new Registeruser {
                Name = _user.Name, DOB = _user.DOB, Address1 = _user.Address1, Address2 = _user.Address2, MedicalHistory = _user.MedicalHistory, PatientHistorical = _user.PatientHistorical, PhoneNumber = _user.PhoneNumber, PersonalMotivator = _user.PersonalMotivator
            };

            Guid   _getkey = (Guid)_getCurrentUser.ProviderUserKey;
            string msg     = PatientManage.UpdateUser(_updateUser, _getkey);

            return(View(_user));
        }
 public ActionResult ForgotPass(PatientModel model)
 {
     if (!string.IsNullOrEmpty(model.Email))
     {
         string password = Registeruser.GetUserPassword(model.Email);
         if (!string.IsNullOrEmpty(password))
         {
             PatientManage.SendPassword(model.Email, string.Empty, password);
             ModelState.AddModelError("EmptyEmail", "Password has been sent to your email address !");
         }
         else
         {
             ModelState.AddModelError("EmptyEmail", "Invalid email address!");
         }
     }
     else
     {
         ModelState.AddModelError("EmptyEmail", "Invalid email address!");
     }
     return(View());
 }