public void ToggleUserFavoriteTeam(Guid teamGUID) { if (SessionProperties.UserGuid == Guid.Empty) return; using(var db = new IntiDataContext(_connectionString)) { var userFavoriteTeam = from uft in db.Ext_UserFavoriteTeam where uft.UserGUID == SessionProperties.UserGuid && uft.TeamGUID == teamGUID select uft; if (userFavoriteTeam.ToList().Count > 0) db.Ext_UserFavoriteTeam.DeleteAllOnSubmit(userFavoriteTeam); else { var newUserFavoriteTeam = new Ext_UserFavoriteTeam(); newUserFavoriteTeam.UserGUID = SessionProperties.UserGuid; newUserFavoriteTeam.TeamGUID = teamGUID; db.Ext_UserFavoriteTeam.InsertOnSubmit(newUserFavoriteTeam); } db.SubmitChanges(); } }
partial void UpdateExt_UserFavoriteTeam(Ext_UserFavoriteTeam instance);
partial void DeleteExt_UserFavoriteTeam(Ext_UserFavoriteTeam instance);
partial void InsertExt_UserFavoriteTeam(Ext_UserFavoriteTeam instance);