using pnp.api.contosoorders.Models; using System; using System.Collections.Generic; using System.Web.Http; using System.Web.Http.Cors; namespace pnp.api.contosoorders.Controllers { public class OrdersController : ApiController { private List orders = new List { new Order { Id = 1, OrderDate = new DateTime(2016, 1, 6), Region = Region.East, Rep = "Jones", Item = "Pencil", Units = 95, UnitCost = 1.99, Total = 189.05 }, new Order { Id = 2, OrderDate = new DateTime(2016, 1, 23), Region = Region.Central, Rep = "Kivell", Item = "Binder", Units = 50, UnitCost = 19.99, Total = 999.50 }, new Order { Id = 3, OrderDate = new DateTime(2016, 2, 9), Region = Region.Central, Rep = "Jardine", Item = "Pencil", Units = 36, UnitCost = 4.99, Total = 179.64 }, new Order { Id = 4, OrderDate = new DateTime(2016, 2, 26), Region = Region.Central, Rep = "Gill", Item = "Pen", Units = 27, UnitCost = 19.99, Total = 539.73 }, new Order { Id = 5, OrderDate = new DateTime(2016, 3, 15), Region = Region.West, Rep = "Sorvino", Item = "Pencil", Units = 56, UnitCost = 2.99, Total = 167.44 } }; [EnableCors("*", "*", "GET", SupportsCredentials = true)] public IEnumerable Get() { return orders; } } }