Ejemplo n.º 1
0
        public async Task <IActionResult> Get(string id)
        {
            var query = new GetHireByIdQuery(id);

            var outcome = await _mediator.Send(query);

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

                if (f is InternalServerException)
                {
                    return StatusCode(StatusCodes.Status500InternalServerError, f.Message);
                }

                return StatusCode(StatusCodes.Status500InternalServerError);
            }));
        }
Ejemplo n.º 2
0
 public async Task <Result <HireResponse> > Handle(GetHireByIdQuery request, CancellationToken cancellationToken)
 {
     return(await _hireService.GetHireAsync(request.Id));
 }