예제 #1
0
        public ActionResult <AuthData> Post([FromBody] RegisterModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var  id     = Guid.NewGuid();
            Guid roleID = Guid.NewGuid();

            Guid.TryParse("9FEE7DA3-01AA-4198-B068-AFD27AE3B7AC", out roleID);
            var user = new User
            {
                Id        = id,
                Login     = model.Login,
                FirstName = model.FName,
                LastName  = model.LName,
                Pass      = authService.HashPassword(model.Password),
                RolesID   = roleID
            };

            userRepository.Add(user);
            userRepository.Commit();

            return(authService.GetAuthData(id.ToString()));
        }