public virtual ActionResult Restore(string ID) { try { // Fetch database info. RestoreSubmission restoreSubmission = new RestoreSubmission(); DatabaseInfo database = MgmtMdl.GetDatabase(ID); restoreSubmission.Database = database; // Preset form. restoreSubmission.Method = "Select"; restoreSubmission.Backups = MgmtMdl.GetBackups(User.Identity.GetADUsername(), database.Name, database.Host, restoreSubmission.Database.Host.Protocol.ToLower()); restoreSubmission.Backups.Insert(0, new SelectListItem { Text = "Select a Backup", Value = "default" }); // Verify user privileges. if (database.Owner != User.Identity.GetADUsername()) { System.Web.HttpContext.Current.Session["StatusMessage"] = "You do not have permisson to access the <strong>" + database.Name + "</strong> database."; return(RedirectToAction("Index", "View")); } return(View("Restore", restoreSubmission)); } catch (Exception e) { System.Web.HttpContext.Current.Session["ErrorInfo"] = e.ToString(); return(RedirectToAction("Error", "View")); } }