Пример #1
0
        public IActionResult Profile(UserViewModel pUser)
        {
            pUser.Type = ConstantsVar.PatientAdministrator;
            User _user2 = lIUserRepository.getUserNpi(pUser.Npi);
            User _user  = UserExtension.UserViewModelToUser(pUser);

            _user.Phone = RemoveSpecialChars(_user.Phone);
            if (_user2 == null)
            {
                string _result = lIUserRepository.UpdateUser(_user);
            }
            else
            {
                TempData["PatientAdministrator"] = JsonConvert.SerializeObject(_user);
                TempData["msg"] = "<script>Helpers.ShowMessage('User with same Npi is already registered, please use different one', 1);</script>";
                pUser.Npi       = null;
                return(View(pUser));
            }
            //string _result = lIUserRepository.UpdateUser(_user);
            if (HttpContext.Session.GetString("UserType") != null && HttpContext.Session.GetString("UserType").ToString() == ConstantsVar.PatientAdministrator.ToString())
            {
                return(RedirectToAction("Profile", new { id = pUser.UserId }));
            }
            return(RedirectToAction("Index"));
        }
        public IActionResult Profile(UserViewModel pUser)
        {
            pUser.Type = 1;
            User _user = UserExtension.UserViewModelToUser(pUser);

            _user.Phone = RemoveSpecialChars(_user.Phone);
            string _result = lIUserRepository.UpdateUser(_user);

            return(RedirectToAction("Index"));
        }
Пример #3
0
        public IActionResult Add(UserViewModel pUser)
        {
            pUser.Type = ConstantsVar.PatientAdministrator;
            User _user    = lIUserRepository.getUser(pUser.UserId);
            User _user2   = lIUserRepository.getUserNpi(pUser.Npi);
            User _userNew = UserExtension.UserViewModelToUser(pUser);

            if ((_user == null) && (_user2 == null))
            {
                _userNew.Phone = RemoveSpecialChars(_userNew.Phone);
                string _User = lIUserRepository.InsertUser(_userNew);
                if (_User == "Username already exists")
                {
                    TempData["Installer"] = JsonConvert.SerializeObject(_userNew);
                    TempData["msg"]       = "<script>Helpers.ShowMessage('User with same Patient Administrator Id is already registered, please use different one', 1);</script>";
                    pUser.UserId          = null;
                    return(View(pUser));
                }
            }
            else
            {
                if (_user2 != null)
                {
                    if (_user2.Npi == _userNew.Npi)
                    {
                        TempData["PatientAdministrator"] = JsonConvert.SerializeObject(_userNew);
                        TempData["msg"] = "<script>Helpers.ShowMessage('User with same Npi is already registered, please use different one', 1);</script>";
                        pUser.Npi       = null;
                        return(View(pUser));
                    }
                }
                if (_user.UserId == _userNew.UserId)
                {
                    TempData["PatientAdministrator"] = JsonConvert.SerializeObject(_userNew);
                    TempData["msg"] = "<script>Helpers.ShowMessage('User with same Patient Administrator Id is already registered, please use different one', 1);</script>";
                    pUser.UserId    = null;
                    return(View(pUser));
                }
            }
            return(RedirectToAction("Index"));
        }