Ejemplo n.º 1
0
        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"));
        }
Ejemplo n.º 2
0
 public IActionResult CreateWedding(Wedding w)
 {
     if (ModelState.IsValid)
     {
         context.Create(w);
         Console.WriteLine(w);
     }
     return(Redirect("dashboard"));
 }