mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-23 01:32:16 +00:00
f
This commit is contained in:
parent
bdfa66ec39
commit
416b924175
1 changed files with 6 additions and 6 deletions
|
@ -110,7 +110,7 @@ public ActionResult CreateUser(CreateUserModel model)
|
|||
return RedirectToAction("Users");
|
||||
}
|
||||
|
||||
public ActionResult BackupDatabase()
|
||||
public ActionResult BackupAssets()
|
||||
{
|
||||
var db = new ApplicationDbContext();
|
||||
string backupDir = "~/Backups/Database";
|
||||
|
@ -123,17 +123,17 @@ public ActionResult BackupDatabase()
|
|||
|
||||
System.IO.Compression.ZipFile.CreateFromDirectory(Server.MapPath("~/Uploads"), backupname);
|
||||
|
||||
var backupData = new DatabaseBackup();
|
||||
var backupData = new AssetBackup();
|
||||
backupData.Id = Guid.NewGuid().ToString();
|
||||
backupData.UserId = User.Identity.GetUserId();
|
||||
backupData.DownloadUrl = backupUrl;
|
||||
backupData.Timestamp = DateTime.Now;
|
||||
db.Backups.Add(backupData);
|
||||
db.AssetBackups.Add(backupData);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Backups");
|
||||
}
|
||||
|
||||
public ActionResult BackupAssets()
|
||||
public ActionResult BackupDatabase()
|
||||
{
|
||||
var db = new ApplicationDbContext();
|
||||
string backupDir = "~/Backups/Assets";
|
||||
|
@ -145,12 +145,12 @@ public ActionResult BackupAssets()
|
|||
string backupname = backupServerDir + "\\ShiftOS-" + DateTime.Now.ToString() + ".sql";
|
||||
const string sqlCommand = @"BACKUP DATABASE [{0}] TO DISK = N'{1}' WITH NOFORMAT, NOINIT, NAME = N'ShiftOS Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10";
|
||||
int path = db.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, string.Format(sqlCommand, db.Database.Connection.Database, backupname));
|
||||
var backupData = new AssetBackup();
|
||||
var backupData = new DatabaseBackup();
|
||||
backupData.Id = Guid.NewGuid().ToString();
|
||||
backupData.UserId = User.Identity.GetUserId();
|
||||
backupData.DownloadUrl = backupUrl;
|
||||
backupData.Timestamp = DateTime.Now;
|
||||
db.AssetBackups.Add(backupData);
|
||||
db.Backups.Add(backupData);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Backups");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue