예제 #1
0
        public UserAccount FillDefineUser(RegisterModel RegisterModel)
        {
            UserAccount DefineUser = new UserAccount();
            DefineUser.IsActive = true;
            DefineUser.Email = RegisterModel.UserName;
            DefineUser.LastName = RegisterModel.Family;
            DefineUser.Name = RegisterModel.Name;
            DefineUser.RoleId = 1;
            DefineUser.CreateDate = DateTime.Now.Date;
            DefineUser.EncrypedPass = Common.CommonMethods.Encrypt(RegisterModel.Password);

            return DefineUser;
        }
예제 #2
0
 public ActionResult CreateUser(RegisterModel RegisterModel)
 {
     if (IsValidSessions())
     {
         if (ModelState.IsValid)
         {
             if (EDefineUser.IsExistUserName(RegisterModel.UserName))
             {
                 UserAccount Define = EDefineUser.FillDefineUser(RegisterModel);
                 Define.RoleId = 1;
                 Define.IsActive = true;
                 _RUser.SaveUserAccount(Define);
                 UserAccount Def = _RUser.UserAccountDetails(Convert.ToInt32(Session["admin"]));
                 _RUser.SaveUserAccount(Define);
             }
             TempData["Message"] = "عملیات با موفقیت انجام شد.";
             TempData["result"] = "OK";
             return RedirectToAction("UserList");
         }
         else
         {
             return View();
         }
     }
     else
         return JavaScript("window.location.href ='/Admin/Home/Login';");
 }