public MobileResponseWrapper GetSavedOptions([FromUri] PickUpRequestViewModel 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.GetSavedDeliveryOptions(request.MemberId, request.Locale); if (result != null) { var mobileResponseWrapper = new MobileResponseWrapper { Data = new PickUpListResponseViewModel { Pickup = result } }; JObject json = JObject.Parse(obj); MobileActivityLogProvider.ActivityLog(json, mobileResponseWrapper, request.MemberId, true, this.Request.RequestUri.ToString(), this.Request.Headers.ToString(), this.Request.Headers.UserAgent.ToString(), request.Locale); return(mobileResponseWrapper); } return(new MobileResponseWrapper { Data = null, //Error = new ErrorViewModel {Code = "0404", Message = "No Data Available"} }); }
public MobileResponseWrapper Get([FromUri] PickUpRequestViewModel 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.GetDeliveryOptions(request.Locale, new AddressViewModel { StateProvinceTerritory = request.State, City = request.City, Country = request.Country, PostalCode = request.PostalCode, CountyDistrict = request.District }); if (result != null) { if (request.City != null && !string.IsNullOrEmpty(request.City) && !string.IsNullOrWhiteSpace(request.City)) { result = result.FindAll(x => !string.IsNullOrEmpty(x.Address.City) ? x.Address.City.Trim() == request.City : x.Address.City == request.City); } if (request.State != null && !string.IsNullOrEmpty(request.State) && !string.IsNullOrWhiteSpace(request.State)) { result = result.FindAll(x => !string.IsNullOrEmpty(x.Address.StateProvinceTerritory) ? x.Address.StateProvinceTerritory.Trim() == request.State : x.Address.StateProvinceTerritory == request.State); } if (request.District != null && !string.IsNullOrEmpty(request.District) && !string.IsNullOrWhiteSpace(request.District)) { result = result.FindAll(x => !string.IsNullOrEmpty(x.Address.CountyDistrict) ? x.Address.CountyDistrict.Trim() == request.District : x.Address.CountyDistrict == request.District); } var mobileListResponseWrapper = new MobileResponseWrapper { Data = new PickUpListResponseViewModel { Pickup = result } }; JObject json = JObject.Parse(obj); MobileActivityLogProvider.ActivityLog(json, mobileListResponseWrapper, request.MemberId, true, this.Request.RequestUri.ToString(), this.Request.Headers.ToString(), this.Request.Headers.UserAgent.ToString(), request.Locale); return(mobileListResponseWrapper); } throw CreateException(HttpStatusCode.InternalServerError, "Location not found", "300404"); }