Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public class CompanyExistsFilter: ActionFilterAttribute, IActionFilter
  2. {
  3. [Authorize]
  4. void IActionFilter.OnActionExecuting(ActionExecutingContext filterContext)
  5. {
  6. var company = new ApplicationDbContext();
  7. if (company.globalCompany.Any())
  8. {
  9. filterContext.Result = new RedirectToRouteResult(
  10. new RouteValueDictionary
  11. {
  12. { "Action", "Create" },
  13. { "Controller","GlobalCompany"}
  14. });
  15.  
  16.  
  17. }else
  18. base.OnActionExecuting(filterContext);
  19.  
  20.  
  21.  
  22.  
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement