public ActionResult Register(RegisterModel model)
 {
     try
     {
         var user = new User
             {
                 Name = model.UserName,
                 Email = model.Email,
                 IsAdmin = false,
                 LastLoginDate = DateTime.Now
             };
         _userContext.Users.Add(user);
         _userContext.SaveChanges();
         var password = _loginService.SetRandomLoginPassword(model.Email);
         SendLoginEmail(model.Email, "Login", user.Name, password);
         return View("LoginWelkom", model);
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("Email", ex.Message);
     }
     return View();
 }
 public ActionResult SendLogin(LoginEmailModel model)
 {
     try
     {
         var password = _loginService.SetRandomLoginPassword(model.Email);
         var user = _userRepository.Find(model.Email);
         SendLoginEmail(model.Email, "Login", user.Name, password);
         var userModel = new RegisterModel
             {
                 Email = user.Email,
                 UserName = user.Name
             };
         return View("LoginWelkom", userModel);
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("Email", ex.Message);
     }
     return View();
 }