Beispiel #1
0
        public ActionResult Create(User user)
        {
            if (_ravenRepository.SingleOrDefault<User>(x => x.UserName.Equals(user.UserName)) == null)
            {
                _ravenRepository.Add(user);
            }

            _formsAuth.SignIn(user.UserName, false);

            return RedirectToAction("Index", "Library");
        }
Beispiel #2
0
        private ActionResult CreateUser(string username, string firstName, string lastName, string email)
        {
            var user = _ravenRepository.SingleOrDefault<User>(x => x.UserName.Equals(username));

            if (user == null)
            {
                user = new User
                           {
                               FirstName = firstName,
                               LastName = lastName,
                               UserName = username,
                               Email = email
                           };

                return View("Register", user);
            }

            _formsAuth.SignIn(user.UserName, false);

            return RedirectToAction("Index", "Library");
        }