Пример #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));
        }
Пример #2
0
        public ActionResult <IEnumerable <CategoryReadDTO> > GetAllCategories()
        {
            var categories = _repo.GetAllCategories();

            return(Ok(_mapper.Map <IEnumerable <CategoryReadDTO> >(categories)));
        }
Пример #3
0
        public ActionResult <IEnumerable <Category> > GetAllCategories()
        {
            var categoryItems = _repository.GetAllCategories();

            return(Ok(_mapper.Map <IEnumerable <CategoryReadDto> >(categoryItems)));
        }
Пример #4
0
 public Task <List <Category> > GetAllCategories()
 {
     return(_repository.GetAllCategories());
 }
Пример #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)));
        }