public static Restaurant ToLibLayer(restaurant restaurantData)
 {
     List<Review> reviewsLib = new List<Review>();
     Restaurant restaurantLib = new Restaurant(restaurantData.name, restaurantData.address, restaurantData.phoneNumber, reviewsLib, restaurantData.id);
     foreach(review curRevData in restaurantData.reviews)
     {
         restaurantLib.reviews.Add(ReviewMapper.ToLibLayer(curRevData, restaurantLib));
     }
     return restaurantLib;
 }
        public static restaurant ToDataLayer(Restaurant restaurantLib)
        {
            restaurant restaurantData = new restaurant();
            restaurantData.id = restaurantLib.id;
            restaurantData.name = restaurantLib.name;
            restaurantData.address = restaurantLib.address;
            restaurantData.phoneNumber = restaurantLib.phoneNum;

            foreach (var curReviewLib in restaurantLib.reviews)
            {
                restaurantData.reviews.Add(ReviewMapper.ToDataLayer(curReviewLib, restaurantData));
            }

            return restaurantData;
        }
Esempio n. 3
0
 public void UpdateReview(Review editFrom)
 {
     dbCrud.Update(ReviewMapper.ToDataLayer(editFrom, RestaurantMapper.ToDataLayer(editFrom.restaurant)));
 }
Esempio n. 4
0
 public void CreateReview(Review toCreate)
 {
     dbCrud.Create(ReviewMapper.ToDataLayer(toCreate, RestaurantMapper.ToDataLayer(toCreate.restaurant)));
 }