namespace WebApiTest.Controllers
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web.Http;
    using WebApiTest.Models;

    public class OrdersController : ApiController
    {
        private readonly List<Order> _orders;

        public OrdersController()
        {
            _orders = new List<Order>();
            _orders.AddRange(new Order[] {
                new Order() 
                {
                    OrderId = 1,
                    OrderDate = DateTime.Now,
                    Freight = 1,
                    ShipCity = "Sofia",
                    ShipName = "Shipper1"
                },
                new Order() 
                {
                    OrderId = 2,
                    OrderDate = DateTime.Now.AddDays(-5),
                    Freight = 2,
                    ShipCity = "Sofia",
                    ShipName = "Shipper2"
                }
            });
        }


        public List<Order> GetOrders()
        {
            return _orders;
        }

        [HttpPost]
        public IHttpActionResult Update(Order order)
        {
            return Ok();
        }
    }
}
