public async Task <IActionResult> Get() { IDataService <Category> _dataService = new CategoryData(); var categories = await _dataService.GetALL(); return(Ok(_mapper.Map <List <CategoryReadDto> >(categories))); }
public async Task <IActionResult> Get(int Id) { IDataService <Category> _dataService = new CategoryData(); var result = await _dataService.GetALL(); var category = result.FirstOrDefault(x => x.ID == Id); return(Ok(_mapper.Map <CategoryReadDto>(category))); }