public static MenuModel Create(object model, string controllerName, string actionName, string roleName) { MenuModel menu; switch (controllerName) { case ShopFloorController: menu = new ShopFloorMenuModel(); break; case AccountController: menu = new AccountsMenuModel(); break; case AdminController: menu = new AdministrationMenuModel(); break; case ReportController: menu = new ReportingMenuModel(); break; default: throw new InvalidOperationException(); } menu.Model = model; menu.ControllerName = controllerName; menu.ActionName = actionName; menu.RoleName = roleName; return(menu); }
public static MenuModel Create(object model, string controllerName, string actionName, string roleName) { MenuModel menu; switch (controllerName) { case ShopFloorController: menu = new ShopFloorMenuModel(); break; case AccountController: menu = new AccountsMenuModel(); break; case AdminController: menu = new AdministrationMenuModel(); break; case ReportController: menu = new ReportingMenuModel(); break; default: throw new InvalidOperationException(); } menu.Model = model; menu.ControllerName = controllerName; menu.ActionName = actionName; menu.RoleName = roleName; return menu; }