Ejemplo n.º 1
0
        public IHttpActionResult AddCustomer(Orders orderadd)
        {
            orders = orderStore.getDictionary();
            Boolean b = true;

            foreach (KeyValuePair <int, Orders> entry in orders)
            {
                if (entry.Key == orderadd.ID)
                {
                    b = false;
                    break;
                }
            }

            if (b == true)
            {
                orders.Add(orderadd.ID, orderadd);
                return(Content(HttpStatusCode.Created, orders));
            }
            else
            {
                return(Content(HttpStatusCode.BadRequest, "Order already exists"));
            }

            orderStore.StoreDictionary(orders);
        }