static void Main(string[] args) { AutoMapperConfig.Initialize(); var container = UnityConfig.GetDefaultContainer(); while (true) { Console.WriteLine("Press 1 for cheese, 2 for pepperoni. x to exit"); var result = Console.ReadLine(); if (result == "x") { return; } try { var service = container.Resolve <IPizzaOrderService>(); var task = service.OrderMenuItemAsync(int.Parse(result)); task.Wait(); var orderId = task.Result; Console.WriteLine("Your order number is " + orderId); } catch (Exception ex) { Console.WriteLine(ex); } } }
public static void Register(HttpConfiguration config) { // Web API configuration and services // Web API routes config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); config.DependencyResolver = new UnityResolver(UnityConfig.GetDefaultContainer()); }