public PickUpResponseViewModel Post(ModifyPickUpRequestViewModel request)
        {
            if (request == null)
            {
                throw CreateException(HttpStatusCode.BadRequest, "Location not found, request Null", "300404");
            }
            string obj = JsonConvert.SerializeObject(request);

            request.Locale = Thread.CurrentThread.CurrentCulture.Name;
            var result = _iMobilePickUpProvider.SavePickUpPreference(request.MemberId, request.PickUpModel,
                                                                     request.Locale);

            if (result != null)
            {
                if (result.IDSaved == -2)
                {
                    //return an error duplicate nick name / Alias
                    return(new PickUpResponseViewModel
                    {
                        Data = null,
                        Error =
                            new ErrorViewModel
                        {
                            Code = 0416,
                            Message =
                                "Invalid or Incomplete Location information: Pick Up Location Alias Duplicated"
                        }
                    });
                }
                if (result.IDSaved == -3)
                {
                    //return an error, PU location saved previousli
                    return(new PickUpResponseViewModel
                    {
                        Data = null,
                        Error =
                            new ErrorViewModel
                        {
                            Code = 0416,
                            Message =
                                "Invalid or Incomplete Location information : Pick Up Location previously saved"
                        }
                    });
                }

                var pickupResponseViewModel = new PickUpResponseViewModel {
                    Data = result, Error = null
                };
                JObject json = JObject.Parse(obj);
                MobileActivityLogProvider.ActivityLog(json, pickupResponseViewModel, request.MemberId, true,
                                                      this.Request.RequestUri.ToString(),
                                                      this.Request.Headers.ToString(),
                                                      this.Request.Headers.UserAgent.ToString(),
                                                      request.Locale);

                return(pickupResponseViewModel);
            }

            throw CreateException(HttpStatusCode.InternalServerError, "Invalid or Incomplete Location information: Error Occurs", "300416");
        }
 public bool Delete(ModifyPickUpRequestViewModel request)
 {
     if (request == null)
     {
         throw CreateException(HttpStatusCode.BadRequest, "Location not found, request Null", "300404");
     }
     try
     {
         request.Locale = Thread.CurrentThread.CurrentCulture.Name;
         return(_iMobilePickUpProvider.DeletePickUpLocation(request.MemberId, request.PickUpModel, request.Locale));
     }
     catch (Exception ex)
     {
         throw CreateException(HttpStatusCode.InternalServerError, "Internal Server Error", "300404");
     }
 }