예제 #1
0
        public async Task <ActionResult <List <CategoryDto> > > getCategories()
        {
            _orm.OpenConn();
            var categoriesFromDB = await _orm.GetAllCategories();

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

            var categoriesDto = _mapper.Map <List <CategoryDto> >(categoriesFromDB);
            await _orm.CloseConn();

            return(Ok(categoriesDto));
        }