Example #1
0
        public ActionResult Index(HomeIndexModel model)
        {
            if (IsConnectionStringInWebConfig(model.SelectedLogDatabase))
            {
                SetConnectionStringCookie(model.SelectedLogDatabase);
                return RedirectToAction("Index");
            }

            return View(model);
        }
Example #2
0
        public ActionResult Index()
        {
            var model = new HomeIndexModel();
            var profiler = MiniProfiler.Current;

            using (profiler.Step("Getting logs from database"))
            using (var sqlConn = CreateProfiledDbConnection())
            {
                model.Errors.AddRange(sqlConn.Query<ELMAHError>(Top100ErrorsQuery));
            }

            model.SelectedLogDatabase = GetSelectedConnectionStringName();
            model.LogDatabases.AddRange(LogDatabaseConnectionStrings.Select(css => new SelectListItem { Text = css.Name.Replace(LogDatabase.ConnectionStringPrefix, string.Empty), Value = css.Name }));

            return View(model);
        }