コード例 #1
0
        public async Task <ActionResult> CreateNewSupplier([FromBody] NewSupplierDTO newSupplierDTO)
        {
            var command = _mapper.Map <AddSupplierCommand>(newSupplierDTO);

            if (!(await SendCommand(command)))
            {
                return(BadRequest(GetComandErrors()));
            }

            return(Created(Url.Link(nameof(GetSupplierbyID), new { supplierID = command.SupplierID }), new { supplierID = command.SupplierID }));
        }
コード例 #2
0
        public async Task <IActionResult> UpdateSupplier([FromBody] NewSupplierDTO supplier)
        {
            var result = await SupplierActor.Ask(
                new AskToUpdateSupplier(
                    supplier.Supplier,
                    supplier.ProductIds
                    ),
                TimeSpan.FromSeconds(15)
                );

            return(ValidateActorResult(result));
        }