private IActionResult CreateView(string viewName, IEnumerable <MenuItem> menu, string controller, string method, MsgVue msg = null) { ViewData["Controller"] = controller; ViewData["Method"] = method; ViewData["Roles"] = RoleM.GetRoles().Where(i => RoleM.ValidationAllowed(i.Id)); if (msg != null) { ViewData["ERROR"] = msg; } return(GetView(viewName, menu)); }
protected IActionResult GetHelloView(MsgVue msg = null) { return(CreateView("Hello", null, "Main", "Index", msg)); }
protected async Task <IActionResult> GetCurrentView(string controller, string method, MsgVue ifHello = null) { User us = await RepositoryBuilder.AuthRepository.GetUserByEmailAsync(User.Identity.Name, true); if (us != null) { var vueInfo = RoleM.GetViewRole(us.Role.Name); ViewData["UserName"] = us.Name == null ? us.Email : us.Name; if (controller == vueInfo.Item2 && ifHello != null) { return(CreateView( vueInfo.Item1, vueInfo.Item3, controller, method)); } else { return(CreateView( vueInfo.Item1, vueInfo.Item3, vueInfo.Item2, vueInfo.Item3.FirstOrDefault().Url, ifHello != null ? new MsgVue("Недостаточно прав") : null)); } } return(GetHelloView(ifHello)); }