Example #1
0
        public async Task <IActionResult> Get(string id)
        {
            var query = new GetBikeById(id);

            return((await _mediator.Send(query)).Match <IActionResult>(
                       s => Ok(s),
                       f =>
            {
                if (f is BadRequestException)
                {
                    return BadRequest(f.Message);
                }

                return StatusCode(StatusCodes.Status500InternalServerError);
            }));
        }
Example #2
0
 public async Task <Result <BikeResponse> > Handle(GetBikeById request, CancellationToken cancellationToken)
 {
     return(await _bikeService.GetBikeAsync(request.Id));
 }