// CREATE public async Task AddReviewAsync(DL.Review item) { using (var db = new LocalGourmetDBEntities()) { db.Reviews.Add(item); await db.SaveChangesAsync(); } }
public static DL.Review LibraryToData(BLL.Models.Review libModel) { var dataModel = new DL.Review(); { dataModel.ID = libModel.ID; dataModel.RestaurantID = libModel.RestaurantID; dataModel.ReviewerName = libModel.ReviewerName; dataModel.Comment = libModel.Comment; dataModel.FoodRating = libModel.FoodRating; dataModel.ServiceRating = libModel.ServiceRating; dataModel.AtmosphereRating = libModel.AtmosphereRating; dataModel.PriceRating = libModel.PriceRating; }; return(dataModel); }
public static BLL.Models.Review DataToLibrary(DL.Review dataModel) { int revID = dataModel.ID; var libModel = new BLL.Models.Review() { ID = dataModel.ID, RestaurantID = dataModel.RestaurantID, ReviewerName = dataModel.ReviewerName, Comment = dataModel.Comment, FoodRating = dataModel.FoodRating, ServiceRating = dataModel.ServiceRating, AtmosphereRating = dataModel.AtmosphereRating, PriceRating = dataModel.PriceRating }; return(libModel); }
// CREATE public async Task AddReviewAsync() { DL.Review review = LibraryToData(this); ReviewAccessor ra = new ReviewAccessor(); await ra.AddReviewAsync(review); }