Ejemplo n.º 1
0
 public bool InsertInterest(string userId, InterestDto interest)
 {
     try
     {
         //Validate user
         if (_userRepository.IsAuthenticated(userId))
         {
             //Validate Model
             ICollection <ValidationResult> results;
             if (IsValidModel(interest, out results))
             {
                 //Call Repository
                 if (_interestRepository.InsertInterest(interest))
                 {
                     //Save
                     if (_interestRepository.Save())
                     {
                         //Success
                         return(true);
                     }
                     _loggingService.Info("Failed To Save");
                 }
                 _loggingService.Info("UserRepository Failed Insert");
             }
             _loggingService.Info("Model Validation Failed: " + interest);
         }
         _loggingService.Info("UserId Authenticated Failed: " + userId);
     }
     catch (Exception ex)
     {
         //Error
         _loggingService.Error("An error has occurred", ex);
     }
     //Fail
     return(false);
 }