Exemplo n.º 1
0
        private void AddRestaurantButton_Click(object sender, EventArgs e)
        {
            var newRestaurantDialog = new AddRestaurantForm();

            newRestaurantDialog.ShowDialog();
            RestaurantListBox.DataSource = _restaurantRepository.GetAllRestaurants();
        }
Exemplo n.º 2
0
 public MainForm()
 {
     InitializeComponent();
     _restaurantRepository           = new RestaurantRepository();
     _employeeRepository             = new EmployeeRepository();
     _recipeRepository               = new RecipeRepository();
     RestaurantListBox.DataSource    = _restaurantRepository.GetAllRestaurants();
     RestaurantListBox.DisplayMember = "Name";
 }
Exemplo n.º 3
0
        public IActionResult Index()
        {
            List <Restaurant>   restaurants = rep.GetAllRestaurants();
            RestaurantViewModel vm          = new RestaurantViewModel
            {
                restaurantDetailViewModels = converter.ModelsToViewModel(restaurants)
            };

            return(View(vm));
        }
Exemplo n.º 4
0
        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");
            }
        }
Exemplo n.º 5
0
        public IActionResult GetAllRestaurants()
        {
            var result = _RestaurantRepository.GetAllRestaurants();

            if (!result.Any())
            {
                return(NotFound("No products available"));
            }

            return(Ok(result));
        }
Exemplo n.º 6
0
 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));
     }
 }
Exemplo n.º 7
0
 public ICollection <Restaurant> GetAllRestaurants()
 {
     return(Repository.GetAllRestaurants());
 }