Esempio n. 1
0
        public async Task <IActionResult> CreateTrip([FromBody] ViewModel.CreateTripCommand command)
        {
            // BadRequest and InternalServerError could be throw in HttpGlobalExceptionFilter
            var domainCommand = _mapper.Map <CreateTripCommand>(command);
            var tripId        = await _dispatcher.SendAsync <Guid>(domainCommand);

            return(Created(HttpContext.Request.GetUri().AbsoluteUri, tripId));
        }
Esempio n. 2
0
        public async Task <IActionResult> CreateTrip([FromBody] ViewModel.CreateTripCommand command)
        {
            // TODO: make command immutable
            // BadRequest and InternalServerError could be throw in HttpGlobalExceptionFilter
            var tripId        = Guid.NewGuid();
            var domainCommand = _mapper.Map <CreateTripCommand>(command);

            domainCommand.AggregateRootId = tripId;
            domainCommand.Source          = Source;
            domainCommand.UserId          = _fakeUser;

            await _dispatcher.SendAsync(domainCommand);

            return(Created(HttpContext.Request.GetUri().AbsoluteUri, tripId));
        }