public ActionResult Signup(string username, string name, string password) { var mgr = new HackerNews.Models.UserManager(@"Data Source=.\sqlexpress;Initial Catalog=HackerNews;Integrated Security=True"); mgr.AddUser(username, password, name); return(RedirectToAction("Signin")); }
public ActionResult Signin(string username, string password) { var mgr = new HackerNews.Models.UserManager(@"Data Source=.\sqlexpress;Initial Catalog=HackerNews;Integrated Security=True"); var user = mgr.GetUser(username, password); if (user == null) { return(View(new UserViewModel { Name = username })); } FormsAuthentication.SetAuthCookie(user.UserName, true); UserViewModel.IsAuthenticated = User.Identity.IsAuthenticated; return(RedirectToAction("Private")); }