public SessionController(KaraokeContext context) { _context = context; bool activeSessionExists = _context.Sessions.Where(s => s.IsActive).Count() > 0; //we've got an active session. There should only one. In any case, set the most recent active session to current session if (activeSessionExists) { _karaokeSessionId = _context.Sessions.Where(s => s.IsActive == true).OrderByDescending(s => s.KaraokeSessionId).Select(s => s.KaraokeSessionId).Single(); } else { //CreateNewSession("New Session"); _karaokeSessionId = -1; } }
public SongsController(KaraokeContext context) { _context = context; }
public InvoiceController(KaraokeContext context) { this.db = context; }
public BookingController(KaraokeContext context) { this.db = context; }
public RoomController(KaraokeContext context) { this.db = context; }
public RoomDAO(KaraokeContext context) { this.db = context; }
public StageNamesController(KaraokeContext context) { _context = context; }
public DetailServiceController(KaraokeContext context) { this.db = context; }
public UserService(KaraokeContext context) { _context = context; }
public SetListController(KaraokeContext context) { _context = context; }
public AdminController(KaraokeContext context) { _context = context; }
public DefaultData(KaraokeContext context) { this.context = context; }
public KaraokeService(KaraokeContext context, IYoutubeService youtubeService, YoutubeHub hub) { this.context = context; this.youtubeService = youtubeService; this.hub = hub; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, KaraokeContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); } app.UseStaticFiles(); app.UseCookiePolicy(); app.UseCors("CorsPolicy"); app.UseSignalR(routes => { routes.MapHub <YoutubeHub> ("/hub"); }); System.Console.WriteLine($"SONG COUNT: {context.Songs.Count()}"); // var songsToRemove = new List<Song> (); // var songsUpdated = new List<Song> (); // var listofWords = new List<string> { // """, // "(", // ")", // "Guitar", // "HD", // "Karaoke", // "lyrics", // "Instrumental", // "Version", // "Female key", // "Coversph", // "]", // "[", // "Acoustic", // "/", // "|", // "OST" // }; // RegexOptions options = RegexOptions.None; // Regex regex = new Regex ("[ ]{2,}", options); // foreach (var song in context.Songs.Include (p => p.SongId).Include (p => p.Snippet)) { // if (string.IsNullOrEmpty (song.SongId.VideoId.Trim ())) { // songsToRemove.Add (song); // } // var songTitle = song.Snippet.Title; // foreach (var item in listofWords) { // songTitle = songTitle.Replace (item, string.Empty, true, CultureInfo.CurrentCulture); // songTitle = regex.Replace (songTitle, " "); // songTitle = songTitle.Replace ("-", " - "); // songTitle = songTitle.Replace ("&", "&"); // songTitle = songTitle.Replace ("'", "'"); // } // song.Snippet.Title = songTitle; // songsUpdated.Add (song); // } // context.Songs.RemoveRange (songsToRemove); // context.Songs.UpdateRange (songsUpdated); // context.SaveChanges (); app.UseMvc(); }
public AuthorizationController(KaraokeContext context) { _context = context; }