add Language data

This commit is contained in:
Collin M. Barrett 2017-10-26 17:18:29 -05:00
parent 5719138a8a
commit 80e4429c37
7 changed files with 1705 additions and 4 deletions

1660
data/Language.json Normal file

File diff suppressed because it is too large Load diff

View file

@ -10,13 +10,21 @@ public FilterListsDbContext(DbContextOptions options)
{
}
public DbSet<FilterList> FilterList { get; set; }
public DbSet<FilterList> FilterLists { get; set; }
public DbSet<Maintainer> Maintainers { get; set; }
public DbSet<Language> Languages { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Maintainer>()
.Property(b => b.CreatedDateUtc)
.HasDefaultValueSql("CURRENT_TIMESTAMP");
modelBuilder.Entity<FilterList>()
.Property(b => b.CreatedDateUtc)
.HasDefaultValueSql("CURRENT_TIMESTAMP");
modelBuilder.Entity<Language>()
.Property(b => b.CreatedDateUtc)
.HasDefaultValueSql("CURRENT_TIMESTAMP");
}
}
}

View file

@ -5,6 +5,8 @@ namespace FilterLists.Data.Contexts
{
public interface IFilterListsDbContext
{
DbSet<FilterList> FilterList { get; set; }
DbSet<Maintainer> Maintainers { get; set; }
DbSet<FilterList> FilterLists { get; set; }
DbSet<Language> Languages { get; set; }
}
}

View file

@ -0,0 +1,13 @@
namespace FilterLists.Data.Models.Contracts
{
public interface ILanguage
{
string Iso6391 { get; set; }
string Iso6392 { get; set; }
string Iso6392B { get; set; }
string Iso6392T { get; set; }
string Iso6393 { get; set; }
string LocalName { get; set; }
string Name { get; set; }
}
}

View file

@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using FilterLists.Data.Models.Contracts;
using Newtonsoft.Json;
@ -7,6 +8,8 @@ namespace FilterLists.Data.Models.Implementations
{
public class FilterList : BaseEntity, IFilterList
{
public List<ILanguage> FilterLists { get; set; }
[JsonIgnore]
public virtual Maintainer Maintainer { get; set; }

View file

@ -0,0 +1,15 @@
using FilterLists.Data.Models.Contracts;
namespace FilterLists.Data.Models.Implementations
{
public class Language : BaseEntity, ILanguage
{
public string Iso6391 { get; set; }
public string Iso6392 { get; set; }
public string Iso6392B { get; set; }
public string Iso6392T { get; set; }
public string Iso6393 { get; set; }
public string LocalName { get; set; }
public string Name { get; set; }
}
}

View file

@ -7,7 +7,7 @@ namespace FilterLists.Data.Models.Implementations
{
public class Maintainer : BaseEntity, IMaintainer
{
public List<FilterList> FilterLists { get; set; }
public List<IFilterList> FilterLists { get; set; }
[Description(@"The email address of the list maintainer.")]
[EmailAddress]