public OperationResult Put(int id, Order order)
        {
            var orderToUpdate = _database.GetOrder(id);

            if (orderToUpdate == null) return new OperationResult.NotFound();

            orderToUpdate.Update(order.Reference, order.Customer, order.Details);
            return new OperationResult.OK(order);
        }
 public OrderPreview(Order order)
 {
     Id = order.Id;
     Reference = order.Reference;
     Uri = order.CreateUri().AbsoluteUri;
 }
Example #3
0
 public void Store(Order order)
 {
     order.Id = NextOrderId++;
     Orders.Add(order);
 }
        public OperationResult Post(Order order)
        {
            _database.Store(order);

            return new OperationResult.Created { RedirectLocation = order.CreateUri(), ResponseResource = order };
        }
Example #5
0
 public void Remove(Order order)
 {
     Orders.Remove(order);
 }