public async Task <IActionResult> GetDestinationByIdAsync( [FromRoute] int id, CancellationToken cancellationToken = default(CancellationToken)) { var query = new GetDestinationPreviewQuery { Id = id }; var result = await Mediator.Send(query, cancellationToken).ConfigureAwait(false); var customer = Mapper.Map <Destination>(result); var response = ResponseFactory.CreateReponse(customer, typeof(DestinationsController), ResponseStatus.Success, "1.0.0"); return(Ok(response)); }
public async Task <IActionResult> AddDestinationAsync( [FromBody] CreateDestination command, CancellationToken cancellationToken = default(CancellationToken)) { var result = await Mediator.Send(command, cancellationToken).ConfigureAwait(false); var desination = Mapper.Map <Destination>(result); return(Created(Url.Link(nameof(GetDestinationByIdAsync), new { result.Id }), ResponseFactory.CreateReponse(desination, typeof(CustomersController), ResponseStatus.Success, "1.0.0"))); }