Ejemplo n.º 1
0
        public async Task <ActionResult <Stock> > Create(StockDataDTO data)
        {
            var result = await this.Mediator.Send(new CreateStockCommand
            {
                Data = data
            });

            return(ResponseHelper.ResponseOutcome <Stock>(result, this));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Update(int id, StockDataDTO data)
        {
            var result = await this.Mediator.Send(new UpdateStockCommand
            {
                Id   = id,
                Data = data
            });

            return(ResponseHelper.ResponseOutcome <Stock>(result, this));
        }
Ejemplo n.º 3
0
        public static Stock Map(this StockDataDTO stock) =>
        (stock != null) ? new Stock
        {
            ExpiryDate     = stock.ExpiryDate,
            Name           = stock.Name,
            Quantity       = stock.Quantity ?? 0,
            UnitOfMeasure  = stock.UnitOfMeasure,
            ValueOfMeasure = stock.ValueOfMeasure,
            Comment        = stock.Comment,
            DateCreated    = DateTime.Now
        }

            : null;