示例#1
0
        public static FavoriteEvent GetEvent(this Favorites favorites, int orgEventId)
        {
            var result = favorites.Events
                         .FirstOrDefault(e => e.Id == orgEventId);

            if (result == null)
            {
                result = new FavoriteEvent {
                    Id = orgEventId
                };
                favorites.Events.Add(result);
            }

            return(result);
        }