public static void insertFavorite(FavoriteModel fm) { // Check if already favored Favorite favorite = (from f in _db.Favorites where f.Route_ID == fm.routeID && f.User_ID == fm.userID select f).SingleOrDefault(); if (favorite == null) { favorite = new Favorite(); favorite.User_ID = fm.userID; favorite.Route_ID = fm.routeID; _db.Favorites.InsertOnSubmit(favorite); _db.SubmitChanges(); // Create event that this route has been favored RouteFavoredEvent rfe = new RouteFavoredEvent(favorite); rfe.save(); } }
partial void DeleteFavorite(Favorite instance);
partial void UpdateFavorite(Favorite instance);
partial void InsertFavorite(Favorite instance);
private void detach_Favorites(Favorite entity) { this.SendPropertyChanging(); entity.User = null; }
private void attach_Favorites(Favorite entity) { this.SendPropertyChanging(); entity.User = this; }