Esempio n. 1
0
        public async Task <IActionResult> GetProvider(int id, bool includeCatalogueItems)
        {
            try
            {
                var provider = await _providerService.GetByIdAsync(id, includeCatalogueItems);

                if (provider == null)
                {
                    return(NotFound());
                }

                return(Ok(provider));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "An error occured."));
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> GetCatalogueItems(int providerId)
        {
            try
            {
                if (await _providerSevice.GetByIdAsync(providerId, false) == null)
                {
                    return(NotFound("No provider with the specified id exists."));
                }

                var catalogueItems = await _catalogueItemService.GetCatalogueItemsForProviderAsync(providerId);

                return(Ok(catalogueItems));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "An error occured."));
            }
        }