Esempio n. 1
0
        public async Task <ActionResult> GetAreasAsync()
        {
            try
            {
                await _topicBus.SendAsync(TopicType.Log.ToString(), "Calling Get Areas..");

                var response = await _areaService.GetAreaAsync();

                if (response != null)
                {
                    return(Ok(_mapper.Map <AreasResponse>(response)));
                }
                else
                {
                    return(NotFound());
                }
            }
            catch (Exception ex)
            {
                await _topicBus.SendAsync(TopicType.Log.ToString(), ex.ToString());

                return(BadRequest(ex));
            }
            finally
            {
                await _topicBus.SendAsync(TopicType.Log.ToString(), "Returning Get Areas..");
            }
        }
Esempio n. 2
0
        public async Task <Ready> CheckStoreStatus()
        {
            var products = await _productService.GetProductsAsync(new ProductRequest()
            {
                StoreName = "Los Angeles - Pasadena"
            });

            var area = await _areaService.GetAreaAsync();

            if ((products != null && products.Count() > 0) && area != null)
            {
                var storeId = products.FirstOrDefault().StoreId;

                await _topicBus.SendAsync(TopicType.StoreCatalogReady.GetDescription(), $"Store: {storeId}. Status: {true}");

                return(new Ready()
                {
                    IsReady = true,
                    StoreId = storeId
                });
            }

            return(null);
        }