protected override bool AuthorizeCore(HttpContextBase httpContext) { var isAuthorized = base.AuthorizeCore(httpContext); if (!isAuthorized) { return false; } if (!string.IsNullOrEmpty(Role)) { using (var unit = new UnitOfWork()) { return unit.UserRepository.IsInRole(httpContext.User.Identity.Name, Role); } } return true; }
public BaseController() { unit = new UnitOfWork(); }