예제 #1
0
        public User CheckIn(UserCheckinModel user)
        {
            string cryptedPassword = MD5Hasher.CalculateHash(user.Password);
            User   newUser         = new User(user.Name, user.Email, cryptedPassword);

            newUser.Id = userRepository.Add(newUser);

            newUser.Token    = GenerateNewToken(newUser.Name);
            newUser.Password = null;
            return(newUser);
        }
 public IActionResult CheckIn([FromBody] UserCheckinModel loginInfo)
 {
     try
     {
         User userData = this.userManager.CheckIn(loginInfo);
         return(this.Ok(userData));
     }
     catch (DuplicateNameException ex)
     {
         return(BadRequest(ex.Message));
     }
 }
예제 #3
0
 public IActionResult CheckIn([FromBody] UserCheckinModel userParam)
 {
     checkInCommand.CheckinModel = userParam;
     try
     {
         var userViewModel = checkInCommand.Execute();
         return(Ok(userViewModel));
     }
     catch (DuplicateLoginException ex)
     {
         return(BadRequest("User with this login already exists."));
     }
 }