예제 #1
0
        public Restaurant addRestaurant(String name, int cuisine, int fanciness, String websiteUrl, String houseNumber, String street1, 
            String street2, String zipCode, String city, String xCoord, String yCoord)
        {
            AddressDAL addressDAL = new AddressDAL();
            Address restaurantAddress = addressDAL.addAddress(houseNumber, street1, street2, zipCode, city);

            Restaurant restaurant = new Restaurant(name, cuisine, fanciness, websiteUrl, restaurantAddress, xCoord, yCoord);
            return restaurant;
        }
        public Restaurant addRestaurant(String name, String cuisine, int fanciness, String websiteUrl, String houseNumber, String street1,
            String street2, String zipCode, String city, String xCoord, String yCoord)
        {
            AddressDAL addressDAL = new AddressDAL();
            Address restaurantAddress = addressDAL.addAddress(houseNumber, street1, street2, zipCode, city);

            PointDAL pointDAL = new PointDAL();
            Point point = pointDAL.addPoint(xCoord, yCoord);

            Restaurant restaurant = new Restaurant(name, cuisine, fanciness, websiteUrl, restaurantAddress, point);

            db.restaurants.Add(restaurant);
            db.Entry(restaurant).State = System.Data.EntityState.Added;
            db.SaveChanges();

            return restaurant;
        }