public async Task <IActionResult> Get()
        {
            try
            {
                List <Category> categories = await _categoriesManager.GetCategories();

                return(Ok(categories));
            }
            catch (CouldNotPerformOperationException ex)
            {
                return(BadRequest(ex));
            }
        }
Exemple #2
0
        public async Task GetCategories()
        {
            if (Categories == null && await HasInternetConnection(true))
            {
                try
                {
                    IsLoading = true;
                    var response = await _categoriesManager.GetCategories();

                    Categories = response?.OrderBy(x => x.CategoryName);
                    IsLoading  = false;
                }
                catch (Exception e)
                {
                    IsLoading = false;
                    await ShowMessage(ErrorMessages.ErrorOccured, e.Message, ErrorMessages.Ok);
                }
            }
        }
        public IActionResult GetCategories()
        {
            var categories = _categoriesManager.GetCategories();

            return(new ObjectResult(categories));
        }