Exemplo n.º 1
0
        public ActionResult Signup(MemberViewModel viewModel)
        {
            IUserCoordinator userCoordinator = new UserCoordinator(new UserContext());
            var user = userCoordinator.AddSimpleUser(
                new User
                {
                    UserId = Guid.NewGuid(),
                    Email = viewModel.Username
                },
                new UserAccount
                {
                    UserAccountId = Guid.NewGuid(),
                    IsAdmin = false,
                    SignupDate = DateTime.Today,
                    IsAuthorized = true,
                    Locked = false,
                    Username = viewModel.Username,
                    Password = viewModel.Password,
                    LastLogin = DateTime.UtcNow
                });

            if (user)
            {
                return RedirectToAction("Index", "Account", viewModel);
            }
            else
            {
                throw new Exception("Signup threw some exception :-(");
            };
        }
Exemplo n.º 2
0
 public ActionResult Login(MemberViewModel viewModel)
 {
     IUserCoordinator userCoordinator = new UserCoordinator(new UserContext());
     var user = userCoordinator.RetrieveSimpleUser(viewModel.Username, viewModel.Password);
     if (user != null)
     {
         return RedirectToAction("Index", "Account");
     }
     else
     {
         throw new Exception("Login didn't work... :-(");
     }
 }