Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CompanyExistsFilter: ActionFilterAttribute, IActionFilter
- {
- [Authorize]
- void IActionFilter.OnActionExecuting(ActionExecutingContext filterContext)
- {
- var company = new ApplicationDbContext();
- if (company.globalCompany.Any())
- {
- filterContext.Result = new RedirectToRouteResult(
- new RouteValueDictionary
- {
- { "Action", "Create" },
- { "Controller","GlobalCompany"}
- });
- }else
- base.OnActionExecuting(filterContext);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement