Exemplo n.º 1
0
        public IActionResult GetMany([FromRoute] long dictid, [FromQuery] int amount = 20, [FromQuery] int pages = 1)
        {
            IResult <List <Mark> > result = _queryBus.Send <GetManyMarksQuery, List <Mark> >(new GetManyMarksQuery(dictid, amount, pages));

            if (!result.IsValid())
            {
                var Error = (InvalidResult <List <Mark> >)result;
                return(BadRequest(Error.Errors));
            }

            var         Success      = (SuccessResult <List <Mark> >)result;
            List <Mark> dictionaries = Success.Data;

            return(Ok(dictionaries.Select(x => MarkMapper.MapToReadModel(x))));
        }
Exemplo n.º 2
0
        public IActionResult Get([FromRoute] long dictid, [FromRoute] long id)
        {
            IResult <Mark> result = _queryBus.Send <GetMarkByIdQuery, Mark>(new GetMarkByIdQuery(dictid, id));

            if (!result.IsValid())
            {
                var Error = (InvalidResult <Mark>)result;
                return(BadRequest(Error.Errors));
            }

            var  Success    = (SuccessResult <Mark>)result;
            Mark dictionary = Success.Data;

            return(Ok(MarkMapper.MapToReadModel(dictionary)));
        }