Esempio n. 1
0
        public async Task <IActionResult> Get(string id)
        {
            NearestStoreLocatorController nearestStoreLocatorController = this;

            if (!nearestStoreLocatorController.ModelState.IsValid || string.IsNullOrEmpty(id))
            {
                return((IActionResult)nearestStoreLocatorController.NotFound());
            }
            //id = id.EnsurePrefix(CommerceEntity.IdPrefix<InventoryInformation>());

            var input = id.Split('|');

            var args = new GetNearestStoreDetailsByLocationArgument()
            {
                Latitude = Convert.ToDouble(input[0]), Longitude = Convert.ToDouble(input[1])
            };

            var result = await nearestStoreLocatorController.Command <GetNearestStoreDetailsByLocationCommand>().Process(nearestStoreLocatorController.CurrentContext, args);

            return(result != null ? (IActionResult) new ObjectResult((object)result) : (IActionResult)nearestStoreLocatorController.NotFound());
        }
        public async Task <IActionResult> Get(string id)
        {
            NearestStoreLocatorController nearestStoreLocatorController = this;

            if (!nearestStoreLocatorController.ModelState.IsValid || string.IsNullOrEmpty(id))
            {
                return(nearestStoreLocatorController.NotFound());
            }

            nearestStoreLocatorController.CurrentContext.Logger.LogInformation("NearestStoreLocatorController: id" + id);

            var input = id.Split('|');

            var args = new GetNearestStoreDetailsByLocationArgument()
            {
                Latitude = Convert.ToDouble(input[0], System.Globalization.CultureInfo.InvariantCulture), Longitude = Convert.ToDouble(input[1], System.Globalization.CultureInfo.InvariantCulture)
            };

            nearestStoreLocatorController.CurrentContext.Logger.LogInformation("NearestStoreLocatorController Converted: Latitude " + args.Latitude + " - Longitude " + args.Longitude);

            var result = await nearestStoreLocatorController.Command <GetNearestStoreDetailsByLocationCommand>().Process(nearestStoreLocatorController.CurrentContext, args);

            return(result != null ? new ObjectResult(result) : (IActionResult)nearestStoreLocatorController.NotFound());
        }