public IActionResult Register(User u) { User userInDb = context.GetUserByEmail(u.Email); if (userInDb != null) { ModelState.AddModelError("Email", "Email already in use!"); } if (ModelState.IsValid) { u.Password = RegisterHasher.HashPassword(u, u.Password); int UserId = context.Create(u); HttpContext.Session.SetInt32("UserId", UserId); return(Redirect("/events")); } return(View("Index")); }
public IActionResult CreateWedding(Wedding w) { if (ModelState.IsValid) { context.Create(w); Console.WriteLine(w); } return(Redirect("dashboard")); }