Beispiel #1
0
        public WebLinkContract(string url, string description, WebLinkCategory category)
        {
            Url = url;
            Description = description;
            Category = category;

            DescriptionOrUrl = !string.IsNullOrEmpty(description) ? description : url;
        }
Beispiel #2
0
        public virtual AlbumWebLink CreateWebLink(string description, string url, WebLinkCategory category)
        {
            ParamIs.NotNull(() => description);
            ParamIs.NotNullOrEmpty(() => url);

            var link = new AlbumWebLink(this, description, url, category);

            WebLinks.Add(link);

            return(link);
        }
Beispiel #3
0
		public SongWebLink(Song song, string description, string url, WebLinkCategory category)
			: base(description, url, category) {

			Song = song;

		}
 public PartialViewResult CreateWebLink(string description, string url, WebLinkCategory category = WebLinkCategory.Other)
 {
     return PartialView("WebLinkEditRow", new WebLinkDisplay { Description = description, Url = url, Category = category });
 }
Beispiel #5
0
		public ArtistWebLink(Artist artist, string description, string url, WebLinkCategory category) 
			: base(description, url, category) {

			Artist = artist;

		}
 public static IQueryable <T> WhereAlbumHasLinkWithCategory <T>(this IQueryable <T> query, WebLinkCategory category)
     where T : IAlbumLink
 {
     return(query.Where(m => m.Album.WebLinks.Any(l => l.Category == category)));
 }
 public CategoryMatcher(WebLinkCategory category, params StringMatcher[] matchers)
 {
     Category = category;
     this.matchers = matchers;
 }
Beispiel #8
0
 public ArtistWebLink(Artist artist, string description, string url, WebLinkCategory category)
     : base(artist, description, url, category)
 {
 }
Beispiel #9
0
        public static void Initialize(WebLinkContext context)
        {
            context.Database.EnsureCreated();



            // Look for any students.
            if (context.WebLinks.Any())
            {
                return;   // DB has been seeded
            }

            var category1 = new Category {
                Id = Guid.NewGuid(), Name = "Tech", CreatedDateTime = DateTime.Now, GraphColor = Color.AliceBlue
            };
            var category2 = new Category {
                Id = Guid.NewGuid(), Name = "Life", CreatedDateTime = DateTime.Now, GraphColor = Color.LightGreen
            };
            var category3 = new Category {
                Id = Guid.NewGuid(), Name = "Hack", CreatedDateTime = DateTime.Now, GraphColor = Color.MediumOrchid
            };
            var category4 = new Category {
                Id = Guid.NewGuid(), Name = "News", CreatedDateTime = DateTime.Now, GraphColor = Color.GreenYellow
            };
            var category5 = new Category {
                Id = Guid.NewGuid(), Name = "Kids", CreatedDateTime = DateTime.Now, GraphColor = Color.Goldenrod
            };

            var categories = new Category[] {
                category1, category2, category3, category4, category5
            };

            foreach (var c in categories)
            {
                context.Categories.Add(c);
            }
            context.SaveChanges();


            var weblink1 = new WebLink {
                Id = Guid.NewGuid(), Name = "Google", Url = "https://google.com", CreatedDateTime = DateTime.Now, IsFaviourite = true
            };
            var weblink2 = new WebLink {
                Id = Guid.NewGuid(), Name = "BBC", Url = "https://bbc.com", CreatedDateTime = DateTime.Now, IsFaviourite = true
            };
            var weblink3 = new WebLink {
                Id = Guid.NewGuid(), Name = "Yahoo", Url = "https://yahoo.com", CreatedDateTime = DateTime.Now
            };
            var weblink4 = new WebLink {
                Id = Guid.NewGuid(), Name = "CodeProject", Url = "https://codeproject.com", CreatedDateTime = DateTime.Now
            };
            var weblink5 = new WebLink {
                Id = Guid.NewGuid(), Name = "Baby Center", Url = "https://babycenter.com", CreatedDateTime = DateTime.Now
            };

            var weblinks = new WebLink[]
            {
                weblink1, weblink2, weblink3, weblink4, weblink5
            };

            foreach (var w in weblinks)
            {
                context.WebLinks.Add(w);
            }
            context.SaveChanges();


            var weblinkCategory1 = new WebLinkCategory {
                WebLinkId = weblink1.Id, CategoryId = category1.Id
            };
            var weblinkCategory2 = new WebLinkCategory {
                WebLinkId = weblink2.Id, CategoryId = category2.Id
            };
            var weblinkCategory3 = new WebLinkCategory {
                WebLinkId = weblink3.Id, CategoryId = category3.Id
            };
            var weblinkCategory4 = new WebLinkCategory {
                WebLinkId = weblink4.Id, CategoryId = category4.Id
            };
            var weblinkCategory5 = new WebLinkCategory {
                WebLinkId = weblink5.Id, CategoryId = category5.Id
            };
            var weblinkCategory6 = new WebLinkCategory {
                WebLinkId = weblink5.Id, CategoryId = category2.Id
            };

            var weblinkCategories = new WebLinkCategory[]
            {
                weblinkCategory1, weblinkCategory2, weblinkCategory3, weblinkCategory4, weblinkCategory5, weblinkCategory6
            };

            foreach (var w in weblinkCategories)
            {
                context.WebLinkCategories.Add(w);
            }
            context.SaveChanges();


            var usage1 = new Usage {
                Id = Guid.NewGuid(), WebLinkId = weblink1.Id, CreatedDateTime = DateTime.Now
            };
            var usage2 = new Usage {
                Id = Guid.NewGuid(), WebLinkId = weblink2.Id, CreatedDateTime = DateTime.Now
            };
            var usage3 = new Usage {
                Id = Guid.NewGuid(), WebLinkId = weblink3.Id, CreatedDateTime = DateTime.Now
            };
            var usage4 = new Usage {
                Id = Guid.NewGuid(), WebLinkId = weblink4.Id, CreatedDateTime = DateTime.Now
            };
            var usage5 = new Usage {
                Id = Guid.NewGuid(), WebLinkId = weblink1.Id, CreatedDateTime = DateTime.Now
            };
            var usage6 = new Usage {
                Id = Guid.NewGuid(), WebLinkId = weblink2.Id, CreatedDateTime = DateTime.Now
            };
            var usage7 = new Usage {
                Id = Guid.NewGuid(), WebLinkId = weblink3.Id, CreatedDateTime = DateTime.Now
            };

            var usages = new Usage[]
            {
                usage1, usage2, usage3, usage4, usage5
            };

            foreach (var u in usages)
            {
                context.Usages.Add(u);
            }
            context.SaveChanges();
        }
Beispiel #10
0
 public AlbumWebLink(Album album, string description, string url, WebLinkCategory category)
     : base(description, url, category)
 {
     Album = album;
 }
Beispiel #11
0
 public AlbumWebLink(Album album, string description, string url, WebLinkCategory category)
     : base(description, url, category)
 {
     Album = album;
 }
 public ReleaseEventWebLink(ReleaseEvent releaseEvent, string description, string url, WebLinkCategory category)
     : base(releaseEvent, description, url, category)
 {
 }
Beispiel #13
0
 public VenueWebLink(Venue venue, string description, string url, WebLinkCategory category)
     : base(venue, description, url, category)
 {
 }
Beispiel #14
0
 public CategoryMatcher(WebLinkCategory category, params StringMatcher[] matchers)
 {
     Category      = category;
     this.matchers = matchers;
 }
Beispiel #15
0
 public virtual UserWebLink CreateWebLink(string description, string url, WebLinkCategory category)
 {
     return(CreateWebLink(new WebLinkContract(url, description, category)));
 }
Beispiel #16
0
 public PartialViewResult CreateWebLink(string description, string url, WebLinkCategory category = WebLinkCategory.Other)
 {
     return(PartialView("WebLinkEditRow", new WebLinkDisplay {
         Description = description, Url = url, Category = category
     }));
 }
 protected GenericWebLink(TEntry entry, string description, string url, WebLinkCategory category)
     : base(description, url, category)
 {
     Entry = entry;
 }
Beispiel #18
0
 public SongWebLink(Song song, string description, string url, WebLinkCategory category)
     : base(description, url, category)
 {
     Song = song;
 }
Beispiel #19
0
 public static IQueryable <Album> WhereHasLinkWithCategory(this IQueryable <Album> query, WebLinkCategory category)
 {
     return(query.Where(m => m.WebLinks.Any(l => l.Category == category)));
 }
 public ReleaseEventSeriesWebLink(ReleaseEventSeries series, string description, string url, WebLinkCategory category)
     : base(series, description, url, category)
 {
 }