public IActionResult GetMany([FromRoute] long dictid, [FromRoute] long themeid, [FromQuery] int amount = 20, [FromQuery] int pages = 1) { IResult <List <Word> > result = _queryBus.Send <GetManyWordsQuery, List <Word> >(new GetManyWordsQuery(dictid, themeid, amount, pages)); if (!result.IsValid()) { var Error = (InvalidResult <List <Word> >)result; return(BadRequest(Error.Errors)); } var Success = (SuccessResult <List <Word> >)result; List <Word> themes = Success.Data; return(Ok(themes.Select(x => WordMapper.MapToReadModel(x)))); }
public IActionResult Get([FromRoute] long dictid, [FromRoute] long themeid, [FromRoute] long id) { IResult <Word> result = _queryBus.Send <GetWordByIdQuery, Word>(new GetWordByIdQuery(dictid, themeid, id)); if (!result.IsValid()) { var Error = (InvalidResult <Word>)result; return(BadRequest(Error.Errors)); } var Success = (SuccessResult <Word>)result; Word word = Success.Data; return(Ok(WordMapper.MapToReadModel(word))); }