Beispiel #1
0
 public virtual IHttpActionResult PutOrder(int orderGroupId, [FromBody] Models.OrderGroup orderGroup)
 {
     try
     {
         var order = _orderRepository.Load <PurchaseOrder>(orderGroupId);
         order = orderGroup.ConvertToPurchaseOrder(order);
         _orderRepository.Save(order);
         return(Ok());
     }
     catch (Exception exception)
     {
         Logger.Error(exception.Message, exception);
         return(InternalServerError(exception));
     }
 }
Beispiel #2
0
        public virtual IHttpActionResult PostOrder([FromBody] Models.OrderGroup orderGroup)
        {
            Logger.LogPost("PostOrder", Request);

            try
            {
                var purchaseOrder = _orderRepository.Create <PurchaseOrder>(orderGroup.CustomerId, orderGroup.Name);
                purchaseOrder = orderGroup.ConvertToPurchaseOrder(purchaseOrder);
                _orderRepository.Save(purchaseOrder);

                return(Ok(purchaseOrder.ConvertToPurchaseOrder()));
            }
            catch (Exception exception)
            {
                Logger.Error(exception.Message, exception);
                return(InternalServerError(exception));
            }
        }