Exemple #1
0
        public static RestaurantModel GetRestaurant(RestaurantViewModel viewModel)
        {
            var restaurant = new RestaurantModel();

            restaurant.Id                    = viewModel.Id;
            restaurant.NameRestaurant        = viewModel.NameRestaurant;
            restaurant.AddressRestaurant     = viewModel.AddressRestaurant;
            restaurant.DescriptionRestaurant = viewModel.DescriptionRestaurant;
            return(restaurant);
        }
Exemple #2
0
        public List <RestaurantViewModel> GetRestaurants()
        {
            var restaurants = dao.getAll();
            List <RestaurantViewModel> list = new List <RestaurantViewModel>();

            for (int i = 0; i < restaurants.Count; i++)
            {
                RestaurantViewModel viewModel = new RestaurantViewModel();
                viewModel.AddressRestaurant     = restaurants[i].AddressRestaurant;
                viewModel.NameRestaurant        = restaurants[i].NameRestaurant;
                viewModel.DescriptionRestaurant = restaurants[i].DescriptionRestaurant;
                viewModel.Id = restaurants[i].Id;
                list.Add(viewModel);
            }
            return(list);
        }