Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
 public BaseController()
 {
     unit = new UnitOfWork();
 }