public MobileResponseWrapper Get([FromUri] PreferredCustomerRequestViewModel request)
        {
            try
            {
                string obj      = JsonConvert.SerializeObject(request);
                var    response = new MobileResponseWrapper
                {
                    Data = _mobileCustomersProvider.GetPreferredCustomers(request)
                };
                JObject json = JObject.Parse(obj);
                MobileActivityLogProvider.ActivityLog(json, response, request.MemberId, true,
                                                      this.Request.RequestUri.ToString(),
                                                      this.Request.Headers.ToString(),
                                                      this.Request.Headers.UserAgent.ToString(),
                                                      request.Locale);

                return(response);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            throw new Exception("Method Get on MobileCustomersController not return values.");
        }
        public PreferredCustomerResponseViewModel GetPreferredCustomers(PreferredCustomerRequestViewModel request)
        {
            var response = new PreferredCustomerResponseViewModel();

            #region validation

            if ((request == null) || string.IsNullOrWhiteSpace(request.MemberId))
            {
                response.Customers = null;
                return(response);
            }

            #endregion

            var result = China.OrderProvider.GetPreferredCustomers(request.MemberId, request.From, request.To);
            if (result == null)
            {
                return(response);
            }

            response.Customers = new List <PreferredCustomerViewModel>();

            foreach (var model in result)
            {
                var retItem = new PreferredCustomerViewModel
                {
                    MemberId   = !string.IsNullOrEmpty(model.CustomerId) ? model.CustomerId.Trim(): model.CustomerId,
                    CustomerId = model.CustomerProfileId.ToString(CultureInfo.InvariantCulture),
                    Name       = model.NameCn,
                };

                response.Customers.Add(retItem);
            }

            return(response);
        }