예제 #1
0
        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));
        }