예제 #1
0
 public ActionResult Profile()
 {
     using (DauGiaEntities ql = new DauGiaEntities())
     {
         NguoiDung tk    = CurrentContext.CurUser();
         string    ten   = tk.TaiKhoan;
         var       model = ql.NguoiDung.Where(p => p.TaiKhoan == ten).FirstOrDefault();
         return(View(model));
     }
 }
예제 #2
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (CurrentContext.IsLogged() == false)
            {
                string controller = filterContext.RouteData.Values["controller"].ToString();
                string action     = filterContext.RouteData.Values["action"].ToString();
                filterContext.Result = new RedirectResult(string.Format(
                                                              "~/Account/Login?retUrl=/{0}/{1}",
                                                              controller,
                                                              action
                                                              )
                                                          );
                return;
            }
            if (CurrentContext.CurUser().PhanQuyen == this.RequiredPermission)
            {
                filterContext.Result = new HttpUnauthorizedResult();
                return;
            }

            base.OnActionExecuting(filterContext);
        }