2009-11-10 20:36:20 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using Orchard.Data;
|
2009-11-10 19:26:37 +00:00
|
|
|
|
using Orchard.Notify;
|
2009-11-10 20:36:20 +00:00
|
|
|
|
using Orchard.Roles.Models;
|
|
|
|
|
using Orchard.Roles.ViewModels;
|
2009-11-10 19:26:37 +00:00
|
|
|
|
|
|
|
|
|
namespace Orchard.Roles.Controllers {
|
|
|
|
|
[ValidateInput(false)]
|
|
|
|
|
public class AdminController : Controller {
|
2009-11-10 20:36:20 +00:00
|
|
|
|
private readonly IRepository<RoleRecord> _roleRepository;
|
2009-11-10 19:26:37 +00:00
|
|
|
|
private readonly INotifier _notifier;
|
|
|
|
|
|
2009-11-10 20:36:20 +00:00
|
|
|
|
public AdminController(IRepository<RoleRecord> roleRepository, INotifier notifier) {
|
|
|
|
|
_roleRepository = roleRepository;
|
2009-11-10 19:26:37 +00:00
|
|
|
|
_notifier = notifier;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult Index() {
|
2009-11-10 20:36:20 +00:00
|
|
|
|
var model = new RolesIndexViewModel {
|
|
|
|
|
Rows = _roleRepository.Fetch(x => x.Name != null)
|
|
|
|
|
.Select(x => new RolesIndexViewModel.Row {
|
|
|
|
|
Role = x
|
|
|
|
|
})
|
|
|
|
|
.ToList()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return View(model);
|
2009-11-10 19:26:37 +00:00
|
|
|
|
}
|
2009-11-10 22:04:02 +00:00
|
|
|
|
|
|
|
|
|
public ActionResult Create() {
|
|
|
|
|
var model = new RoleCreateViewModel();
|
|
|
|
|
return View(model);
|
|
|
|
|
}
|
2009-11-10 19:26:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|