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); }
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)); }
public async Task <ActionResult <int> > Create(CreateInventoryCommand command) { return(await Mediator.Send(command)); }