public async Task <IActionResult> GetCategory([FromBody] GetCategoryInputDto getinput) { if (!ModelState.IsValid) { return(BadRequest()); } var result = await CategoryServise.GetCategoryByName(getinput); return(Ok(result)); }
public async Task <GetCategoryOutputDto> GetCategoryByName(GetCategoryInputDto getinput) { var findcategory = await FindCategory(getinput.YourCategory); var result = CategoryRepoditory.GetQuery() .Include(c => c.TuristPlaceCategory) .Where(c => c.Name == findcategory.Name) .Select(c => mapper.Map <GetCategoryOutputDto>(c)) .FirstOrDefault(); return(result); }
public async Task <ICollection <CategoryDto> > GetAllCategories(GetCategoryInputDto input) { return((await _categoryManager.GetAllCategoryAsync()).MapTo <List <CategoryDto> >()); }