public Audio(KamishibaServerContext context, Book book, Models.Audio audio) { id = audio.ID; audio.Register = context.TUser.Single(u => u.ID == audio.RegisterID); title = audio.Title; author = audio.Register.Name; contact = $"https://twitter.com/{audio.Register.ScreenName}"; publish_date = audio.PublishedDate; official = audio.RegisterID == book.RegisterID; track_timing = audio.TrackTiming.Trim('[', ']', ' ').Split(',').Select(d => double.Parse(d)).ToArray(); }
public IndexTemplate(KamishibaServerContext context, Book book) { id = book.IDName; title = book.Title; author = book.Auther; contact = book.Contact; page_count = Directory.GetFiles("wwwroot" + Path.DirectorySeparatorChar + "packages" + Path.DirectorySeparatorChar + book.IDName, "*.jpg").Length; audio_count = context.Audio.Count(a => a.BookID == book.ID); publish_date = book.PublishedDate; genre = book.Tags.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(t => t.Trim()).ToList(); sexy = book.Sexy; violence = book.Violence; grotesque = book.Grotesque; download_status = false; }
public static void Main(string[] args) { var host = BuildWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { var context = services.GetRequiredService <KamishibaServerContext>(); context.Database.Migrate(); KamishibaServerContext.Initialize(services); } catch (Exception ex) { var logger = services.GetRequiredService <ILogger <Program> >(); logger.LogError(ex, "An error occurred seeding the DB."); } } host.Run(); }
public PackageTemplate(KamishibaServerContext context, Book book) { id = book.IDName; title = book.Title; author = book.Auther; contact = book.Contact; page_count = Directory.GetFiles("wwwroot" + Path.DirectorySeparatorChar + "packages" + Path.DirectorySeparatorChar + book.IDName, "???.jpg").Length; audio_count = context.Audio.Count(a => a.BookID == book.ID); publish_date = book.PublishedDate; genre = book.Tags.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(t => t.Trim()).ToList(); sexy = book.Sexy; Violence = book.Violence; grotesque = book.Grotesque; download_status = false; description = book.Description; audio = new List <Audio>(); foreach (var a in context.Audio.Where(a => a.BookID == book.ID)) { audio.Add(new Audio(context, book, a)); } }
public KamishibaController(KamishibaServerContext context) : base() { this.context = context; }
public ApiController(KamishibaServerContext context) : base(context) { }
public BooksController(KamishibaServerContext context) : base(context) { }
public AuthenticationController(IAuthenticationSchemeProvider authenticationSchemeProvider, KamishibaServerContext context) : base(context) { this.authenticationSchemeProvider = authenticationSchemeProvider; }