Example #1
0
        public async Task <ActionResult <ShipmentDetailViewModel> > CreateShipment([FromBody] CreateShipmentCommand newShipment)
        {
            var result = await _Mediator.Send(newShipment);

            var Shipment = await _Mediator.Send(new GetShipmentByIdQuery()
            {
                Id = result
            });

            return(StatusCode(201, Shipment));
        }
Example #2
0
        public async Task <IActionResult> Post([FromBody] CreateShipmentCommand command)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }

            var response = await this._mediator.Send(command);

            return(this.Created(Url.RouteUrl("GetShipmentById", new { id = response.Id }), new { }));
        }
Example #3
0
        public IActionResult CreateShipment(CreateShipmentCommand shipment)
        {
            _mediator.Send(shipment);

            return(Ok());
        }
        public IActionResult CreateShipment(CreateShipmentCommand shipment)
        {
            _mediator.Send(shipment);

            return(Ok("Created successfully"));
        }