public ActionResult GetMessages() { UserProfile currentUser = (Session["UserProfileSession"] as UserProfile); MessagesRepository _messageRepository = new MessagesRepository(); return(PartialView("_MessagesList", _messageRepository.GetAllUnreadMessages(currentUser.Id))); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } ConnectionString = ConfigurationRoot["ConnectionStrings:Db"]; app.UseCors("MyPolicy"); app.UseStaticFiles(); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider( Path.Combine(Directory.GetCurrentDirectory(), "MyStaticFiles")), RequestPath = "/StaticFiles" }); //app.UseHangfireDashboard("/dashboard"); app.UseHangfireDashboard("/hangfiredashboard", new DashboardOptions { Authorization = new[] { new HangfireAuthorizationFilter() }, }); app.UseHangfireServer(); app.UseHttpsRedirection(); app.UseAuthentication(); app.UseSignalR(routes => { routes.MapHub <MessagesHub>("/chat"); }); System.Data.SqlClient.SqlDependency.Start(ConnectionString); MessagesRepository.GetAllUnreadMessages(); app.UseMvc(); //BackgroundJob.Schedule(() => ApplyWatermark(filename), TimeSpan.FromMinutes(5)); //BackgroundJob.Schedule(() => Debug.WriteLine(new DateTime().ToLocalTime()), TimeSpan.FromMinutes(1)); }