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()); }
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()); }