public static DataLayer.Restaurant LibraryToData(Restaurant libModel) { var dataModel = new DataLayer.Restaurant() { ID = libModel.ID, name = libModel.name, address = libModel.address, city = libModel.city, state = libModel.state, zipCode = libModel.zipCode, phoneNumber = libModel.phoneNumber, avgRating = libModel.avgRating }; return(dataModel); }
public static DataLayer.Restaurant ToData(Restaurant webRestaurant) { var dataRestaurant = new DataLayer.Restaurant() { ID = webRestaurant.ID, name = webRestaurant.name, address = webRestaurant.address, city = webRestaurant.city, state = webRestaurant.state, zipCode = webRestaurant.zipCode, phoneNumber = webRestaurant.phoneNumber, avgRating = webRestaurant.avgRating }; return(dataRestaurant); }
// MAPPING------------------------------------------------------------ public static Restaurant DataToLibrary(DataLayer.Restaurant dataModel) { var libModel = new Restaurant() { ID = dataModel.ID, name = dataModel.name, address = dataModel.address, city = dataModel.city, state = dataModel.state, zipCode = dataModel.zipCode, phoneNumber = dataModel.phoneNumber, avgRating = dataModel.avgRating }; return(libModel); }
//var db = new RestaurantsDBEntities(); // return db.Reviews.Where(r => r.RestaurantId == restId); //public IEnumerable<Review> ShowRestaurantReviews(int restId) //{ // IEnumerable<Review> result; // var dataList = _db.Reviews.ToList(); // Reviews = (dataList.Where(x => x.RestaurantId == restId)); // //result = dataList.Select(x => ToWebReview(x)).ToList(); // return result; //} // MAPPING--------------------------------------------------------------- public static Restaurant ToWeb(DataLayer.Restaurant dataRestaurant) { var webRestaurant = new Restaurant() { ID = dataRestaurant.ID, name = dataRestaurant.name, address = dataRestaurant.address, city = dataRestaurant.city, state = dataRestaurant.state, zipCode = dataRestaurant.zipCode, phoneNumber = dataRestaurant.phoneNumber, avgRating = dataRestaurant.avgRating }; return(webRestaurant); }