Пример #1
0
        public ActionResult TopNavBar()
        {
            var user  = User.Identity.Name;
            var login = AccountService.GetLoginByEmail(user);

            if (login == null)
            {
                return(View("Error"));
            }
            var userRoles         = AccountService.GetUserRolesbyEmail(user);
            var isOwner           = PropertyOwnerService.IsLoginOwner(login);
            var isTenant          = TenantService.IsLoginATenant(login);
            var isServiceSupplier = CompanyService.IsServiceSupplier(login);
            var isAdmin           = AccountService.IsAdmin(login);
            var model             = new SideBarViewModel
            {
                Roles             = userRoles,
                IsPropertyOwner   = userRoles.Contains(4),
                IsTenant          = userRoles.Contains(5),
                IsServiceSupplier = userRoles.Contains(6),
                IsAdmin           = userRoles.Contains(2),
                IsPropManager     = userRoles.Contains(3)
            };

            return(PartialView(model));
        }
Пример #2
0
        public ActionResult Dashboard()
        {
            var user = User.Identity.Name;
            //var gp = User as GenericPrincipal;
            //var roles = gp.Claims
            //         .Where(c => c.Type == ClaimTypes.Role)
            //         .Select(c => c.Value);
            var login             = AccountService.GetLoginByEmail(user);
            var isOwner           = PropertyOwnerService.IsLoginOwner(login);
            var isTenant          = TenantService.IsLoginATenant(login);
            var isServiceSupplier = CompanyService.IsServiceSupplier(login);
            var isPropertyManager = PropertyOwnerService.IsLoginPropertyManager(login);
            var tenant            = db.Tenant.FirstOrDefault(x => x.Id == login.Id);

            ViewBag.IsOwner           = false;
            ViewBag.IsTenant          = false;
            ViewBag.IsServiceSupplier = false;
            ViewBag.IsPropertyManager = false;

            if (isOwner)
            {
                ViewBag.isOwner = true;
            }

            if (isTenant)
            {
                ViewBag.IsTenant = true;

                if (tenant != null && tenant.IsCompletedPersonalProfile == false)
                {
                    return(RedirectToAction("Onboarding", "Home", new { area = "Tenants" }));
                }
            }

            if (isServiceSupplier)
            {
                ViewBag.IsServiceSupplier = true;
            }

            if (isPropertyManager)
            {
                ViewBag.IsPropertyManager = true;
            }
            //if (tenant.IsCompletedPersonalProfile == false)
            //{
            //    return RedirectToAction("Onboarding", "Home", new { area = "Tenants" });
            //}

            TempData["CurrentLink"] = "Dashboard";
            return(View());
        }
Пример #3
0
        public ActionResult SideNavBar()
        {
            var user              = User.Identity.Name;
            var login             = AccountService.GetLoginByEmail(user);
            var userRoles         = AccountService.GetUserRolesbyEmail(user);
            var isOwner           = PropertyOwnerService.IsLoginOwner(login);
            var isTenant          = TenantService.IsLoginATenant(login);
            var isServiceSupplier = CompanyService.IsServiceSupplier(login);
            var isAdmin           = AccountService.IsAdmin(login);
            var model             = new SideBarViewModel
            {
                Roles             = userRoles,
                IsPropertyOwner   = isOwner,
                IsTenant          = isTenant,
                IsServiceSupplier = isServiceSupplier,
                IsAdmin           = isAdmin
            };

            return(PartialView(model));
        }
Пример #4
0
        public ActionResult Dashboard()
        {
            var user = User.Identity.Name;
            //var gp = User as GenericPrincipal;
            //var roles = gp.Claims
            //         .Where(c => c.Type == ClaimTypes.Role)
            //         .Select(c => c.Value);
            var login             = AccountService.GetLoginByEmail(user);
            var isOwner           = PropertyOwnerService.IsLoginOwner(login);
            var isTenant          = TenantService.IsLoginATenant(login);
            var isServiceSupplier = CompanyService.IsServiceSupplier(login);
            var isPropertyManager = PropertyOwnerService.IsLoginPropertyManager(login);

            ViewBag.IsOwner           = false;
            ViewBag.IsTenant          = false;
            ViewBag.IsServiceSupplier = false;
            ViewBag.IsPropertyManager = false;

            if (isOwner)
            {
                ViewBag.isOwner = true;
            }

            if (isTenant)
            {
                ViewBag.IsTenant = true;
            }

            if (isServiceSupplier)
            {
                ViewBag.IsServiceSupplier = true;
            }

            if (isPropertyManager)
            {
                ViewBag.IsPropertyManager = true;
            }
            TempData["CurrentLink"] = "Dashboard;";
            return(View());
        }