BuildFeed/Areas/admin/Controllers/baseController.cs
2014-12-16 14:43:26 +00:00

34 lines
837 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
namespace BuildFeed.Areas.admin.Controllers
{
public class baseController : Controller
{
[Authorize(Roles = "Administrators")]
// GET: admin/base
public ActionResult index()
{
return View();
}
[Authorize(Users = "hounsell")]
public ActionResult setup()
{
if (!Roles.RoleExists("Administrators"))
{
Roles.CreateRole("Administrators");
}
if (!Roles.IsUserInRole("hounsell", "Administrators"))
{
Roles.AddUserToRole("hounsell", "Administrators");
}
return RedirectToAction("index");
}
}
}