Exemplo n.º 1
0
        public IHttpActionResult AddLine([FromODataUri] System.Guid key, [FromBody] OrderLine entity)
        {
            logger.Trace("Call OrderController AddLine");

            entity.OrderId = key;

            var record = orderLineRepository.Create(entity);

            return(Created <OrderLine>(record));
        }
Exemplo n.º 2
0
        public 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 = orderLineRepository.Create(entity);

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

            return(Created(record));
        }