static void Main()
        {
            //RunAsync().Wait();
            RestInterfaceAsync rest = new RestInterfaceAsync();
            //var categories =  rest.GetCategories().Result;
            //Console.WriteLine("Id       Name        CategoryId");
            //foreach (var cat in categories)
            //{
            //    Console.WriteLine("{0}      {1}     {2}",cat.Id,cat.Name,cat.CategoryId);
            //}
            //var waiters = rest.GetWaiters().Result;
            //Console.WriteLine("Id       FirstName       LastName        Password");
            //foreach (var w in waiters)
            //{
            //    Console.WriteLine("{0}      {1}     {2}     {3}", w.Id, w.FirstName, w.LastName,w.Password);
            //}
            //var products = rest.GetProducts().Result;
            //Console.WriteLine("Id       Name        CategoryId      Price");
            //foreach (var p in products)
            //{
            //    Console.WriteLine("{0}      {1}     {2}     {3}", p.Id, p.Name, p.CategoryId,p.Price);
            //}
            //var orders = rest.GetOrders().Result;
            //Console.WriteLine("Id       TableId        Paid     Processed       WaiterId");
            //foreach (var o in orders)
            //{
            //    Console.WriteLine("{0}      {1}     {2}     {3}     {4}", o.Id, o.TableId, o.Paid,o.Processed,o.WaiterId);
            //}
            //var orderItems = rest.GetOrderItems().Result;
            //Console.WriteLine("Id       ProductId        Quantity       OrderId");
            //foreach (var i in orderItems)
            //{
            //    Console.WriteLine("{0}       {1}      {2}      {3}",i.Id,i.ProductId,i.Quantity,i.OrderId);
            //}
            //var items = rest.GetItemsInOrder(11).Result;
            //Console.WriteLine("Items in order with id 11");
            //Console.WriteLine("Id       ProductId        Quantity       OrderId");
            //foreach (var i in items)
            //{
            //    Console.WriteLine("{0}       {1}      {2}      {3}", i.Id, i.ProductId, i.Quantity, i.OrderId);
            //}
            var item = new OrderItem
            {
                Quantity = 3,
                ProductId = 21,
                OrderId = 11
            };
            //var resp = rest.AddOrderItem(11,item).Result;
            //Console.WriteLine(resp ? "Added item to existing order!" : "Error while adding item to existing order");
            //var resp = rest.DeleteOrderItem(41).Result;
            //Console.WriteLine(resp ? "Deleted item!" : "Error while deleting item!");
            //var resp = rest.DeleteOrder(21).Result;
            //Console.WriteLine(resp ? "Deleted order!" : "Error while deleting item!");

            //Console.ReadLine();
            HttpClientHandler handler = new HttpClientHandler();
            var client = new HttpClient(handler) {BaseAddress = new Uri("http://iorderonlineapp.azurewebsites.net/")};
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            Order order = new Order
            {
                OrderItems = new List<OrderItem>
                {
                    new OrderItem{
                        Quantity = 3,
                        ProductId = 21
                    }
                },
                Paid=false,
                Processed = false,
                TableId = 10
            };
            //HttpResponseMessage resp = client.PostAsJsonAsync("api/Orders", order).Result;
            //HttpResponseMessage resp = client.DeleteAsync("api/Orders/21").Result;
            //Console.WriteLine(resp.IsSuccessStatusCode ? "Added order!" : "Error!");
            //Console.WriteLine(resp.IsSuccessStatusCode ? "Deleted order!" : "Error!");

            Console.ReadLine();
        }
        public override View GetChildView(int groupPosition, int childPosition, bool isLastChild, View convertView, ViewGroup parent)
        {
            View row = act.LayoutInflater.Inflate(Resource.Layout.product_row, parent,false);

            TextView tv1 = row.FindViewById<TextView>(Resource.Id.ProductName);
            TextView tv2  = row.FindViewById<TextView>(Resource.Id.Price);
            Button btn = row.FindViewById<Button>(Resource.Id.AddProductToOrder);

            Product p = children[groups[groupPosition].Id][childPosition];

            tv1.SetTextColor(Color.Red);
            tv2.SetTextColor(Color.Red);
            tv1.Text = p.Name;
            tv2.Text = p.Price + " kn";

            btn.Click += delegate
            {
                bool found=false;
                foreach (OrderItem item in DataRepository.MyOrderItems)
                {
                    if (item.ProductId == p.Id)
                    {
                        item.Quantity += 1;
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    OrderItem orderItem = new OrderItem
                    {
                        ProductId = p.Id,
                        Quantity = 1
                    };
                    DataRepository.MyOrderItems.Add(orderItem);
                    Toast.MakeText(act, "Added " + p.Name, ToastLength.Short).Show();
                }
                else
                {
                    Toast.MakeText(act, p.Name + "  +1", ToastLength.Short).Show();

                }
            };
            return row;
        }
 /// <summary>
 /// Addes order item to order specified by orderId.
 /// </summary>
 /// <param name="orderId"></param>
 /// <param name="item"></param>
 /// <returns></returns>
 public async Task<bool> AddItemToOrder(int orderId, OrderItem item)
 {
     var _item = new OrderItem
     {
         OrderId = orderId,
         ProductId = item.ProductId,
         Quantity = item.Quantity,
     };
     HttpResponseMessage response = await client.PostAsJsonAsync(uriOrderItems, _item);
     if (response.IsSuccessStatusCode)
     {
         return true;
     }
     return false;
 }