Exemple #1
0
        public IActionResult GetCategories()
        {
            var categories = _repo.GetAllCategories();

            if (categories == null)
            {
                return(NotFound(new { message = "Database doesn't contain any categories" }));
            }
            List <CategoryDto> objDtos = new List <CategoryDto>();

            foreach (var item in categories)
            {
                objDtos.Add(_mapper.Map <CategoryDto>(item));
            }

            return(Ok(objDtos));
        }
Exemple #2
0
        public ActionResult <IEnumerable <CategoryReadDTO> > GetAllCategories()
        {
            var categories = _repo.GetAllCategories();

            return(Ok(_mapper.Map <IEnumerable <CategoryReadDTO> >(categories)));
        }
        public ActionResult <IEnumerable <Category> > GetAllCategories()
        {
            var categoryItems = _repository.GetAllCategories();

            return(Ok(_mapper.Map <IEnumerable <CategoryReadDto> >(categoryItems)));
        }
 public Task <List <Category> > GetAllCategories()
 {
     return(_repository.GetAllCategories());
 }
Exemple #5
0
        public List <Category> GetAllCategories()
        {
            List <Category> categories = repo.GetAllCategories();

            return(categories);
        }
        public async Task <IActionResult> GetAllCategories(string value)
        {
            var categories = await _repo.GetAllCategories(value);

            return(Ok(_mapper.Map <IEnumerable <CategoryReadDto> >(categories)));
        }