public HttpResponseMessage GetUserProfile(string emailAddress)
 {
     try
     {
         var userInfo = _eloquaService.GetContactDetailsByEmail(emailAddress);
         if (userInfo == null)
         {
             ModelState.AddModelError("EmailAddress", WellknownResponseMessages.EmailNotExisted);
             return(Request.CreateResponse(HttpStatusCode.BadRequest, new UserProfileResponseDTO
             {
                 Success = false,
                 StatusCode = 400,
                 Message = WellknownResponseMessages.Falied,
                 Errors = ModelState.AllErrors()
             }));
         }
         if (!ValidateIdentity(userInfo.EloquaContactId))
         {
             ModelState.AddModelError("InvalidRequest", WellknownResponseMessages.InvalidRequest);
             return(Request.CreateResponse(HttpStatusCode.BadRequest, new UserProfileResponseDTO
             {
                 Success = false,
                 StatusCode = 400,
                 Message = WellknownResponseMessages.Falied,
                 Errors = ModelState.AllErrors()
             }));
         }
         var response = PauHelper.MapContactDetailToRegisterAccountModel(userInfo);
         return(Request.CreateResponse(HttpStatusCode.OK, new UserProfileResponseDTO
         {
             Success = true,
             StatusCode = 200,
             Message = WellknownResponseMessages.Success,
             UserInfo = response
         }));
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, new UserProfileResponseDTO
         {
             Success = false,
             StatusCode = 500,
             Message = WellknownResponseMessages.Falied,
             Errors = new List <string> {
                 ex.Message + "\r\n" + ex.StackTrace
             }
         }));
     }
 }
        public HttpResponseMessage CheckUserExisting(string emailAddress)
        {
            try
            {
                var userInfo = _eloquaService.GetContactDetailsByEmail(emailAddress);
                if (userInfo == null || (userInfo != null && userInfo.MyPanasonicMember != 1))
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new ResponseDTO
                    {
                        Success = false,
                        StatusCode = 400,
                        Message = WellknownResponseMessages.EmailNotExisted
                    }));
                }

                ModelState.AddModelError("EmailAddress", WellknownResponseMessages.EmailExisted);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, new ResponseDTO
                {
                    Success = true,
                    StatusCode = 200,
                    Message = WellknownResponseMessages.EmailExisted,
                    Errors = ModelState.AllErrors()
                }));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, new ResponseDTO
                {
                    Success = false,
                    StatusCode = 500,
                    Message = WellknownResponseMessages.Falied,
                    Errors = new List <string> {
                        ex.Message + "\r\n" + ex.StackTrace
                    }
                }));
            }
        }