Esempio n. 1
0
        public ActionResult UpdateInternalUser(ViewModel.InternalUserViewModel user)
        {
            GenericAjaxResponse <bool> response = new GenericAjaxResponse <bool>();

            try
            {
                if (ModelState.IsValid)
                {
                    Core.DTO.InternalUserInfo userInfo = new Core.DTO.InternalUserInfo();
                    userInfo.ActiveHealthId = user.ActiveHealthId;
                    userInfo.TableauId      = user.TableauId;
                    response = _restClient.UpdateInternalUser(userInfo);
                    if (response == null)
                    {
                        response         = new GenericAjaxResponse <bool>();
                        response.Success = false;
                        response.Errors.Add("Could not process your request.");
                    }
                    else
                    {
                        response.Success = response.Data;
                    }
                }
                else
                {
                    foreach (var modelKey in ModelState.Keys)
                    {
                        response.Errors.AddRange(ModelState[modelKey].Errors.Select(err => err.ErrorMessage));
                    }
                    response.Success = response.Errors.Count == 0;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Errors.Add("Could not process your request");
                _logger.Info("Could not map internal user to tableau account. Error " + ex.Message);
            }
            return(Json(response));
        }
Esempio n. 2
0
 public GenericResponse <bool> UpdateInternalUserInfo(Core.DTO.InternalUserInfo userInfo)
 {
     AHP.Core.Model.GenericResponse <bool> response = new Core.Model.GenericResponse <bool>();
     try
     {
         if (userInfo == null)
         {
             response.Success = false;
             response.Data    = false;
             response.Errors.Add("User information provided is empty");
             return(response);
         }
         response = _userInfoManager.UpdateInternalUser(userInfo);
     }
     catch (Exception ex)
     {
         _logger.Error("Error occurred creating new user account. Error info - ", ex);
         response.Success = false;
         response.Errors.Add("Could not process your request");
     }
     return(response);
 }