Ejemplo n.º 1
0
        public async Task <IHttpActionResult> Post([FromBody] OrderLine entity)
        {
            logger.Trace("Call OrderLineController Post");

            var price = productPriceRepository.GetByProductId(entity.ItemId);

            if (price != null)
            {
                entity.Price  = (float)price.Price;
                entity.Amount = entity.Qty * entity.Price;
            }

            var record = await orderLineRepository.CreateAsync(entity);

            await Task.Factory.StartNew(async() => await RecalcOrderAsync(entity.OrderId));

            return(Created(record));
        }