Пример #1
0
        public ActionResult MyAccount()
        {
            int userId = (Int32)Session["TheUserID"];

            var listUserTypes = uType.ListUserTypes();

            ViewBag.listUserTypesDll = new SelectList(listUserTypes, "User_type_id", "User_type_name");

            var usertoSearch = user.SearchUser(userId);
            var usersToShow  = Mapper.Map <Models.Users>(usertoSearch);

            return(View(usersToShow));
        }
        public ActionResult CreateAccount(Users users)
        {
            var listUserTypes = uType.ListUserTypes();

            ViewBag.listUserTypesDll = new SelectList(listUserTypes, "User_type_id", "User_type_name");

            if (users.User_name != null)
            {
                try
                {
                    if (!ModelState.IsValid)
                    {
                        return(View());
                    }

                    var userToAdd = Mapper.Map <DATA.Users>(users);
                    user.AddUser(userToAdd);
                    //user.CreatedUserAccountSentEmail(users.User_email,users.User_name);
                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                return(View());
            }
        }