async public Task <InventoryData> GetStoresInventory(int storeId) { GetStoreByIdRequest request = new GetStoreByIdRequest(storeId); comm.SendRequest(request); GetStoreByIdResponse response = await comm.Get <GetStoreByIdResponse>(); return(response.Store.Products); }
public GetStoreByIdResponse GetStoreById(int id) { GetStoreByIdResponse response = new GetStoreByIdResponse(); SystemFail error = new SystemFail(); Store store = storeService.GetStoreById(id, error); if (store != null && !error.Error) { response.store = new StoreDTO(); response.store.Address = store.Address; response.store.Id = store.Id; response.store.Name = store.Name; response.success = true; } else { response.success = false; } return(response); }
public static Store GetStoreById(int storeId, ISystemFail error) { Store store = null; try { string webServiceUrl = string.Concat(AppKeys.WebServiceURL, AppKeys.WebServiceStoreControllerName); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("id", storeId.ToString()); string response = Proxy.ProxyService.GetRequestURlConcatParameters(webServiceUrl, error, parameters); if (!string.IsNullOrEmpty(response) && !error.Error) { GetStoreByIdResponse apiResponse = JsonConvert.DeserializeObject <GetStoreByIdResponse>(response); if (apiResponse.success) { store = apiResponse.store; } else { error.Error = true; error.Message = string.Concat("An error has ocurred obtaining the specific store"); } } else { error.Error = true; error.Message = string.Concat("An error has ocurred obtaining the specific store. Error:", error.Message); } } catch (Exception ex) { error.Error = true; error.Exception = ex; error.Message = string.Concat("An error has ocurred obtaining the specific store. Error:", ex.Message); } return(store); }