Exemplo n.º 1
0
        public MembershipUser CreateUser(string name, string email, string password)
        {
            MembershipUser membershipUser = GetUser(email, false);

            if (membershipUser == null)
            {
                try
                {
                    int userRoleId = _roleService.GetAllRoleEntities().First(role => role.Name == "user").Id;
                    MvcUser mvcUser = new MvcUser()
                    {
                        Name = name,
                        Email = email,
                        RoleId = userRoleId,
                        Password = Crypto.HashPassword(password),
                        CreationDate = DateTime.Now
                    };

                    _userService.CreateUser(mvcUser.ToBllUser());
                    membershipUser = GetUser(email, false);
                    return membershipUser;

                }
                catch
                {
                    return null;
                }
            }
            return null;
        }
Exemplo n.º 2
0
 public ActionResult DeleteConfirmed(MvcUser user)
 {
     _userService.DeleteUser(user.ToBllUser());
     return RedirectToAction("Index");
 }