public ActionResult NewRestaurant(string name, int cuisineId) { Restaurants newRestaurant = new Restaurants(name, cuisineId); newRestaurant.Save(); return(RedirectToAction("Index")); }
public ActionResult input() { string newPlace = Request.Form["restaurant"]; Restaurants newRestaurant = new Restaurants(newPlace, 0); newRestaurant.Save(); int id = int.Parse(Request.Form["selection"]); Cuisine cuisine = Cuisine.Find(id); newRestaurant.AddCuisine(cuisine); ViewModel collection = new ViewModel(newRestaurant, cuisine); return(RedirectToAction("ViewAll")); }
public void GetRestaurants_GetsSetsRestaurant_ReturnEqualValue() { Restaurants newRestaurant = new Restaurants("Taco Bell", 1); newRestaurant.Save(); string nameResult = newRestaurant.RestaurantName; List <Restaurants> listResult = Restaurants.GetAll(); List <Restaurants> actualRestaurantList = new List <Restaurants>() { newRestaurant }; Assert.AreEqual("Taco Bell", nameResult); CollectionAssert.AreEqual(actualRestaurantList, listResult); }