public async Task <IActionResult> GetBrandsAsync(bool update = false) { try { _logger?.LogDebug("GetBrandsAsync()..."); if (!_zipato.IsLocked) { return(StatusCode(StatusCodes.Status406NotAcceptable, "Locked: update not yet finished.")); } if (update) { var(brands, status) = await _zipato.DataReadBrandsFullAsync(); if (status.IsGood) { return(Ok(brands)); } else { return(StatusCode(StatusCodes.Status502BadGateway, status)); } } else { var brands = _zipato.Data.Brands.Select(b => b.ToBrandData()).ToList(); return(Ok(brands)); } } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }