public RedirectResult Register(LoginViewModel model) { IAccountRepository repository = UnityConfig.GetConfiguredContainer().Resolve<IAccountRepository>(); IAuthenticationService service = UnityConfig.GetConfiguredContainer().Resolve<IAuthenticationService>(); Account account = new Account() { Id = Guid.NewGuid(), Name = model.Name, Password = model.Password }; repository.CreateAccount(account); service.Login(model.Name, model.Password, model.RememberMe); if (IsAuthenticated) { return new RedirectResult("/home/index", false); } return new RedirectResult("/account/login", false); }
public void CreateAccount(Account account) { Accounts.Add(account); }