Пример #1
0
        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();
            }
        }
Пример #2
0
 partial void DeleteFavorite(Favorite instance);
Пример #3
0
 partial void UpdateFavorite(Favorite instance);
Пример #4
0
 partial void InsertFavorite(Favorite instance);
Пример #5
0
		private void detach_Favorites(Favorite entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
Пример #6
0
		private void attach_Favorites(Favorite entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}