public JsonResult GetNearbyStores(GetNearbyStoresInputModel inputModel)
        {
            try
            {
                Assert.ArgumentNotNull(inputModel, "inputModel");

                var validationResult = new BaseJsonResult();
                this.ValidateModel(validationResult);
                if (validationResult.HasErrors)
                {
                    return(Json(validationResult, JsonRequestBehavior.AllowGet));
                }

                var response = this.StoreManager.GetNearbyStores(CurrentStorefront, CurrentVisitorContext, inputModel);
                var result   = new NearbyStoresJsonResult(response.ServiceProviderResult);
                if (!response.ServiceProviderResult.Success || response.Result == null)
                {
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }

                result.Initialize(response.Result.ToList());
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                CommerceLog.Current.Error("GetNearbyStores", this, e);
                return(Json(new BaseJsonResult("GetNearbyStores", e), JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult GetNearbyStoresJson(GetNearbyStoresInputModel inputModel)
        {
            Assert.ArgumentNotNull(inputModel, "inputModel");

            return(Json(new { success = false, errors = new List <string> {
                                  "Not supported in CS Connect"
                              } }));
        }
        public JsonResult GetNearbyStoresJson(GetNearbyStoresInputModel inputModel)
        {
            Assert.ArgumentNotNull(inputModel, "inputModel");

            //var response = this.StoreManager.GetNearbyStores(CurrentStorefront, CurrentVisitorContext, inputModel);
            //var result = new GetNearbyStoresJsonResult(response.ServiceProviderResult);
            //return Json(result, JsonRequestBehavior.AllowGet);
            return(Json(new { success = false, errors = new List <string> {
                                  "Not supported in CS Connect"
                              } }));
        }
        /// <summary>
        /// Gets the near by stores.
        /// </summary>
        /// <param name="storefront">The storefront.</param>
        /// <param name="visitorContext">The visitor context.</param>
        /// <param name="inputModel">The input model.</param>
        /// <returns>
        /// The manager response where the stores are returned in the Result.
        /// </returns>
        public ManagerResponse <GetNearbyStoresResult, IReadOnlyCollection <Store> > GetNearbyStores([NotNull] CommerceStorefront storefront, [NotNull] VisitorContext visitorContext, [NotNull] GetNearbyStoresInputModel inputModel)
        {
            Assert.ArgumentNotNull(storefront, "storefront");
            Assert.ArgumentNotNull(visitorContext, "visitorContext");
            Assert.ArgumentNotNull(inputModel, "inputModel");
            Assert.ArgumentNotNullOrEmpty(inputModel.Latitude, "inputModel.Latitude");
            Assert.ArgumentNotNullOrEmpty(inputModel.Longitude, "inputModel.Longitude");

            var request = new GetNearbyStoresRequest(System.Convert.ToDecimal(inputModel.Latitude, CultureInfo.InvariantCulture), System.Convert.ToDecimal(inputModel.Longitude, CultureInfo.InvariantCulture), 10);
            var result  = this.StoreServiceProvider.GetNearbyStores(request);

            if (!result.Success)
            {
                Helpers.LogSystemMessages(result.SystemMessages, result);
            }

            return(new ManagerResponse <GetNearbyStoresResult, IReadOnlyCollection <Store> >(result, result.Stores));
        }