コード例 #1
0
        public void CreateInventory(CreateInventoryCommand command)
        {
            var inventory = _mapper.Map <CreateInventoryCommand, Inventory>(command);

            inventory.Description = inventory.Description?.ToUpperInvariant().Trim();
            inventory.Name        = inventory.Name.Trim().ToUpperInvariant();

            _set.Add(inventory);
        }
コード例 #2
0
        public async Task <ActionResult <InventoryApiModel> > CreateInventory([FromBody] CreateInventoryCommand command)
        {
            var result = await _mediator.Send(command).ConfigureAwait(false);

            if (result.CurrentResponseStatus == ResponseStatus.Success)
            {
                return(BadRequest(result));
            }
            return(CreatedAtRoute("InventoryById",
                                  new { id = result.Data.Id }, result));
        }
コード例 #3
0
 public async Task <ActionResult <int> > Create(CreateInventoryCommand command)
 {
     return(await Mediator.Send(command));
 }