// GET: Restaurant/Create public async Task <ActionResult> Create() { // var rescats = new Dictionary<string, RestaurantCategory>(); // rescats.Add("-No Category-", null); // foreach (RestaurantCategory x in proxy.GetAllRestaurantCategories()) // { // rescats.Add(x.Name, x); // } // // var model = new RestaurantViewModel { Restaurant = new Restaurant(), Categories = rescats }; var categories = new List <RestaurantCategory>(); categories.Add(new RestaurantCategory { Id = 0, Name = "-No Category-" }); categories.AddRange(await _proxy.GetAllRestaurantCategoriesAsync()); var model = new RestaurantViewModel { Restaurant = new Restaurant(), CategoryList = new SelectList(categories, "Id", "Name", 1) }; return(View("Create", model)); }
// GET: RestaurantCategory public async Task <ActionResult> Index() { return(View(await _proxy.GetAllRestaurantCategoriesAsync())); }