示例#1
0
 public void CreateNoti(int userID, string message, string link)
 {
     var obj = new WebLib.Models.fwNotification();
     obj.UserID = userID; obj.Title = message; obj.Link = link;
     new WebLib.DAL.fwNotificationDAL().Insert(obj);
     var u = new WebLib.DAL.fwUserDAL().GetByID(userID);
     u.NotiCount += 1;
     new WebLib.DAL.fwUserDAL().Update(u);
 }
示例#2
0
 protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
 {
     var k = new WebLib.DAL.fwUserDAL().Authorize(TheRoles);
     if (k == 0) return;
     if (k == 1)
         filterContext.Result = new RedirectToRouteResult(new
             RouteValueDictionary(new { controller = "Account", action = "Login", returnUrl = filterContext.RequestContext.HttpContext.Request.RawUrl }));
     else
         filterContext.Result = new RedirectToRouteResult(new
             RouteValueDictionary(new { controller = "Home", action = "AccessDenied" }));
 }