Exemple #1
0
 public ActionResult Register(UserViewModel userViewModel)
 {
     if (ModelState.IsValid)
     {
         userService.CreateUser(userViewModel);
         return RedirectToAction("Login");
     }
     return View();
 }
Exemple #2
0
        public ActionResult Login(UserViewModel user)
        {
            var userViewModel = userService.Find(user.Email);
            if (userViewModel == null)
            {
                ViewBag.IsFailed = true;
                ViewBag.LastFailedEmail = user.Email;
                return View();
            }

            ViewBag.IsFailed = false;
            return View("UserInfo", userViewModel);
        }
Exemple #3
0
        public void CreateUser(UserViewModel user)
        {
            var userEntity = new User
            {
                LastName = user.LastName,
                FirstName = user.FirstName,
                MiddleName = user.MiddleName,
                Email = user.Email,
                Description = user.Description
            };

            using (var context = contextFactory.Create())
            {
                context.Users.Add(userEntity);
                context.SaveChanges();
            }
        }