Пример #1
0
        public ActionResult <RentalModelResult> PostRental([FromBody] CreateRentCommand createRentCommand)
        {
            Guid rentId = Guid.Empty;

            _commandDispatcher.Send(createRentCommand, out rentId);

            var modelToReturn = _mapper.Map <RentalModelResult>(createRentCommand);

            modelToReturn.RentalId = rentId;

            return(CreatedAtRoute("GetRent", new { rentId = rentId }, modelToReturn));
        }
 public void Handle(CreateRentCommand command)
 {
     _RentService.Create(command.Rent);
     _RentService.Complete();
 }
 public async Task <ActionResult <Guid> > AddRent(CreateRentCommand command)
 {
     return(await Mediator.Send(command));
 }
Пример #4
0
        public void Create(RentItemViewModel RentItemViewModel)
        {
            CreateRentCommand createRentCommand = new CreateRentCommand(_mapper.Map <Rent>(RentItemViewModel));

            QueueSender.Send(createRentCommand);
        }
        public async Task <ActionResult> CreateRent([FromBody] CreateRentCommand command)
        {
            var mediator = await _Mediator.Send(command);

            return(StatusCode(201, mediator));
        }