* T.cs: * IModule.cs: * App.master: * IProvider.cs: * Error.aspx: * AOEMail.aspx: * Login.aspx: * Index.aspx: * Admin.aspx: * yavscModel.csproj: * WFManager.cs: * Index.aspx: * AddRole.aspx: * Profile.aspx: * Edit.aspx: * Register.aspx: * Index.aspx: * RoleList.aspx: * UserList.aspx: * Validate.aspx: * RemovePost.aspx: * Index.aspx: * BasketImpact.cs: * Brand.aspx: * Delete.aspx: * Create.aspx: * Backups.aspx: * HomeController.cs: * BlogManager.cs: * Restore.aspx: * Details.aspx: * TitleNotFound.aspx: * Product.aspx: * AdminController.cs: * Command.aspx: * Service.aspx: * BlogProvider.cs: * NewProject.aspx: * Catalog.aspx: * Restored.aspx: * BasketController.cs: * AccountController.cs: * WorkFlowController.cs: * BlogsApiController.cs: * ChangePassword.aspx: * RemoveRoleQuery.aspx: * CreateBackup.aspx: * IContentProvider.cs: * BackOfficeController.cs: * FrontOfficeController.cs: * NpgsqlBlogProvider.cs: * NpgsqlContentProvider.cs: * RegistrationPending.aspx: * ProductCategory.aspx: * FrontOfficeApiController.cs: * ChangePasswordSuccess.aspx: * ReferenceNotFound.aspx: * BackupCreated.aspx Fixes many HTTP 500 Refactoring on the go
70 lines
1.7 KiB
C#
70 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using Yavsc.Admin;
|
|
using yavscModel.Admin;
|
|
|
|
|
|
namespace Yavsc.Controllers
|
|
{
|
|
public class BackOfficeController : Controller
|
|
{
|
|
[Authorize(Roles="Admin")]
|
|
public ActionResult Index(DataAccess model)
|
|
{
|
|
return View (model);
|
|
}
|
|
[Authorize(Roles="Admin")]
|
|
public ActionResult Backups(DataAccess model)
|
|
{
|
|
return View (model);
|
|
}
|
|
|
|
[Authorize(Roles="Admin")]
|
|
public ActionResult CreateBackup(DataAccess datac)
|
|
{
|
|
if (datac != null) {
|
|
if (ModelState.IsValid) {
|
|
if (string.IsNullOrEmpty (datac.Password))
|
|
ModelState.AddModelError ("Password", "Invalid passord");
|
|
DataManager ex = new DataManager (datac);
|
|
Export e = ex.CreateBackup ();
|
|
if (e.ExitCode > 0)
|
|
ModelState.AddModelError ("Password", "Operation Failed");
|
|
return View ("BackupCreated", e);
|
|
}
|
|
} else {
|
|
datac = new DataAccess ();
|
|
}
|
|
return View (datac);
|
|
}
|
|
|
|
[Authorize(Roles="Admin")]
|
|
public ActionResult CreateUserBackup(DataAccess datac,string username)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
[Authorize(Roles="Admin")]
|
|
public ActionResult Upgrade(DataAccess datac) {
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
[Authorize(Roles="Admin")]
|
|
public ActionResult Restore(DataAccess datac,string backupName,bool dataOnly=true)
|
|
{
|
|
ViewData ["BackupName"] = backupName;
|
|
if (ModelState.IsValid) {
|
|
DataManager mgr = new DataManager (datac);
|
|
ViewData ["BackupName"] = backupName;
|
|
ViewData ["DataOnly"] = dataOnly;
|
|
TaskOutput t = mgr.Restore (backupName,dataOnly);
|
|
return View ("Restored", t);
|
|
}
|
|
return View (datac);
|
|
}
|
|
|
|
}
|
|
}
|