Beispiel #1
0
        public List <LibRestaurant> PrintRestaurants()
        {
            //RestaurantData crud = new RestaurantData();
            List <LibRestaurant> returnRestaurants = new List <LibRestaurant>();

            foreach (RestaurantReviewData.Restaurant dbr in crud.PrintRestaurants())
            {
                LibRestaurant tempRestaurant = ModelConverter.DBToResObject(dbr);
                foreach (Review rev in dbr.Reviews)
                {
                    tempRestaurant.Reviews.Add(ModelConverter.DBToRevObj(rev));
                }
                tempRestaurant.AvgRating = CalculateAvgRating(tempRestaurant);
                returnRestaurants.Add(tempRestaurant);
            }

            return(returnRestaurants);
        }
Beispiel #2
0
        public LibReview GetReview(int ID)
        {
            Review foundRev = crud.FindRevByID(ID);

            return(ModelConverter.DBToRevObj(foundRev));
        }
Beispiel #3
0
 public LibRestaurant SearchResByID(int id)
 {
     return(ModelConverter.DBToResObject(crud.FindRestByID(id)));
 }
Beispiel #4
0
 public void EditReview(LibReview editReview)
 {
     crud.AddReview(ModelConverter.RevObjToDB(editReview));
 }
Beispiel #5
0
 public void AddReviewToDB(LibReview newReview)
 {
     crud.AddReview(ModelConverter.RevObjToDB(newReview));
 }
Beispiel #6
0
 public void UpdateRestaurantInDB(LibRestaurant update)
 {
     crud.UpdateRestaurant(ModelConverter.ResObjToDB(update));
 }
Beispiel #7
0
 public void AddRestaurantToDB(LibRestaurant newRestaurant)
 {
     crud.UpdateRestaurant(ModelConverter.ResObjToDB(newRestaurant));
 }