Exemple #1
0
        public ActionResult Upload(HttpPostedFileBase file)
        {
            if (file != null && file.ContentLength > 0)
            {
                var fileName = Path.GetFileName(file.FileName);
                //var path = Path.Combine(Server.MapPath("~/Images/Database/"), fileName);
                file.SaveAs(BackupRestore.Getdatabases("(local)").BackupDirectory + "\\FullBackUp.bak");
                BackupRestore.RestoreDatabase();
            }



            return(RedirectToAction("RestoreDatabase"));
        }
 public static void RestoreDatabaseFromBackUp()
 {
     BackupRestore.RestoreDatabase(Constants.Server,
         Constants.DatabaseName,
         Constants.BackUpPath);
 }