public object Post(RegistrationInfo registrationInfo)
 {
     var user = userService.GetUserByLogin(registrationInfo.Login);
     if (user != null)
         return new HttpResponseMessage(HttpStatusCode.Conflict)
         {
             ReasonPhrase = UserAlreadyExistsMessage
         }; ;
     var userId = userService.CreateUser(registrationInfo);
     var token = tokenService.CreateToken(userId, registrationInfo.Login);
     var response = new TokenResponse
     {
         Id = userId,
         Login = registrationInfo.Login,
         Token = token,
     };
     return response;
 }
 public object Post(Credentials credentials)
 {
     var user = userService.GetUserByLogin(credentials.Login);
     if (user != null &&
         cryptographyService.CheckPassword(user.PasswordHash, user.PasswordSalt, credentials.Password))
     {
         var token = tokenService.CreateToken(user.Id, user.Login);
         var response = new TokenResponse
         {
             Id = user.Id,
             Login = credentials.Login,
             Token = token,
         };
         return response;
     }
     var message = new HttpResponseMessage(HttpStatusCode.BadRequest)
     {
         ReasonPhrase = UnknownUserMessage
     };
     return message;
 }