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