public async Task <WordDto[]> Search(SearchWordDto input)
        {
            if (input == null)
            {
                input = new SearchWordDto();
            }

            var query = _db.Words.Include(x => x.WordGroup).AsQueryable();

            if (input.GroupId.HasValue && input.GroupId.Value != 0)
            {
                query = query.Where(x => x.WordGroupId == input.GroupId);
            }

            return((await query.ToListAsync()).ToEntityDtoList <WordDto, Word>().ToArray());
        }
Ejemplo n.º 2
0
 public async Task <IActionResult> Search([FromBody] SearchWordDto input)
 {
     return(new JsonResult(await _wordService.Search(input)));
 }