Beispiel #1
0
 public bool UpdateMemberProfileResponses(string memberId, IList <MemberProfileQAModel> profileResponse)
 {
     if (_asaMemberAdapter.IsCurrentUser(memberId))
     {
         if (MemberProfileResponseValidation.validateMemberProfileResponse(profileResponse))
         {
             return(_asaMemberAdapter.UpdateMemberProfileResponses(memberId, profileResponse));
         }
         else
         {
             throw new System.ComponentModel.DataAnnotations.ValidationException();
         }
     }
     else
     {
         throw new WebFaultException <string>("Not Authorized", System.Net.HttpStatusCode.Unauthorized);
     }
 }
Beispiel #2
0
        public bool UpsertQuestionAnswer(QuestionAnswerReponseModel choicesResponse)
        {
            const string logMethodName = "- QuestionAnswerResponse(QuestionAnswerReponseModel choicesResponse) - ";

            Log.Debug(logMethodName + "Begin Method");

            bool result = false;

            try
            {
                ASAMemberModel currentUser = GetMemberFromContext();
                if (_asaMemberAdapter.IsCurrentUser(choicesResponse.memberId))
                {
                    if (MemberProfileResponseValidation.validateMemberQAResponse(choicesResponse))
                    {
                        result = _asaMemberAdapter.UpsertQuestionAnswer(choicesResponse.memberId, choicesResponse.choicesList);
                    }
                    else
                    {
                        throw new System.ComponentModel.DataAnnotations.ValidationException();
                    }
                }
                else
                {
                    throw new WebFaultException <string>("Not Authorized", System.Net.HttpStatusCode.Unauthorized);
                }
            }
            catch (ValidationException validatEx)
            {
                string errMsg = validatEx.Message;
                if (choicesResponse.choicesList.Count == 0)
                {
                    errMsg = string.Format("{0}: choicesResponse failed validation {1}", "Exception executing your request in UpsertQuestionAnswer", "object choicesResponse.choicesList must have length greater than zero " + errMsg + ". Call exited without change.");
                }
                Log.Error(errMsg, validatEx.StackTrace);
            }
            catch (Exception ex)
            {
                Log.Error("Exception executing your request in UpsertQuestionAnswer:", ex);
            }
            Log.Debug(logMethodName + "End Method");
            return(result);
        }