Пример #1
0
 public HttpResponseMessage PostUser([FromBody] Models.Registration user)
 {
     _repository.AddUser(user.Email, user.Name, user.Surname);
     return(Request.CreateResponse
                (System.Net.HttpStatusCode.Created,
                string.Format("User {0} was sucessfully added", user.Name)));
 }
        public IActionResult SignUpCredentials(SignUpCredentialsModel model)
        {
            if (ModelState.IsValid)
            {
                _registrationService.AddUser(model.FirstName, model.LastName,
                                             DateTime.Parse(model.Day + model.Month + model.Year), model.Gender,
                                             model.Email, model.Password, model.Existed, model.Remembered);

                return(View("SignUpResult", model));
            }

            return(View());
        }
Пример #3
0
 public IActionResult SignUp(HomeModel model)
 {
     if (_registration.AddUser(model.User))
     {
         _logger.Log(Messages.userRegistered);
         _logger.LogStats(model.User);
         _errorHandler.ShowError(this, Messages.userRegistered, "Info");
     }
     else
     {
         _errorHandler.ShowError(this, Messages.userRegistrationError);
         _logger.Log(Messages.userRegistrationError);
     }
     return(RedirectToAction("Index", "Home"));
 }
Пример #4
0
        public async Task <IActionResult> Index(string email, string password, string username)
        {
            var user = new User()
            {
                Email    = email,
                Password = password,
                Nickname = username,
                Projects = new List <Project>()
            };
            var id = await _registrationService.AddUser(user);

            HttpContext.Response.Cookies.Append("currentUserId", id.ToString());
            CurrentUserService.currentUserId = id;
            CurrentUserService.loggedIn      = true;
            return(RedirectToAction("Index", "ProjectsList"));
        }