private void AddRestaurantButton_Click(object sender, EventArgs e) { var newRestaurantDialog = new AddRestaurantForm(); newRestaurantDialog.ShowDialog(); RestaurantListBox.DataSource = _restaurantRepository.GetAllRestaurants(); }
public MainForm() { InitializeComponent(); _restaurantRepository = new RestaurantRepository(); _employeeRepository = new EmployeeRepository(); _recipeRepository = new RecipeRepository(); RestaurantListBox.DataSource = _restaurantRepository.GetAllRestaurants(); RestaurantListBox.DisplayMember = "Name"; }
public IActionResult Index() { List <Restaurant> restaurants = rep.GetAllRestaurants(); RestaurantViewModel vm = new RestaurantViewModel { restaurantDetailViewModels = converter.ModelsToViewModel(restaurants) }; return(View(vm)); }
static void Main(string[] args) { int resID; RestaurantRepository repo = new RestaurantRepository(); //repo.L(5); //Add Method //repo.Add(RestaurantDummyData()); //Remove Method //resID = 3; //if (repo.Remove(resID)) // Console.WriteLine("Retaurant is Deleted"); //else // Console.WriteLine("Restaurant not found"); //GetByID Method //resID = 5; //Restaurant restaurant = repo.GetByID(resID); //Console.Write("Id : " + restaurant.ID + "\nName : " + restaurant.name + "\nRating : "); //foreach (var ratings in restaurant.rating) // Console.Write(ratings.rating + "\t"); //Console.Write("\nCuisine Type : "); //foreach (var resCuisine in restaurant.restaurantCuisine) // Console.Write(resCuisine.cuisineType.cuisineType + "\t"); //Console.WriteLine("\n\n"); //GetAll Method List <Restaurant> restaurantList = repo.GetAllRestaurants(); foreach (var res in restaurantList) { Console.Write("Id : " + res.ID + "\nName : " + res.name + "\nRating : "); foreach (var ratings in res.rating) { Console.Write(ratings.rating + "\t"); } Console.Write("\nCuisine Type : "); foreach (var resCuisine in res.restaurantCuisine) { Console.Write(resCuisine.cuisineType.cuisineType + "\t"); } Console.WriteLine("\n\n"); } }
public IActionResult GetAllRestaurants() { var result = _RestaurantRepository.GetAllRestaurants(); if (!result.Any()) { return(NotFound("No products available")); } return(Ok(result)); }
public void GetAllRestaurants() { try { // Arrange var restaurantRepository = new RestaurantRepository(RestaurantReviewsContext); // Act var restaurants = restaurantRepository.GetAllRestaurants().Result; // Assert Assert.IsTrue(restaurants.Count() >= DataSeeder.Restaurants.Count() , string.Format("Database has {0} Restaurants and Seeder has {1}", restaurants.Count(), DataSeeder.Restaurants.Count())); } catch (Exception ex) { Assert.Fail(string.Format("An unexpected exception occurred in GetAllRestaurants {0}", ex.Message)); } }
public ICollection <Restaurant> GetAllRestaurants() { return(Repository.GetAllRestaurants()); }