- var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
- var orgid = await _context.UsersData.Where(s => s.Id == userId).Select(s => s.OrgID).FirstOrDefaultAsync();
-
- var roles = await (from a in _context.UsersData.Where(a => a.Id == userId)
- join b in _context.CompanyDatas on a.OrgID equals b.OrgID into TempData1
- from c in TempData1
- join d in _context.AppIdentityRoles on a.Id equals d.UserId into TempData2
- from e in TempData2
- join f in _context.UsersRole on e.RoleId equals f.Id into TempData3
- from g in TempData3
-
- select new
- {
- RoleName = g.Name
- }).ToListAsync();
-
-
-
- string myS = "WOCraftTL";
- var status = await _context.WOMains.Where(s => s.WOMainID == womainid).Select(s => s.WOStatus).SingleOrDefaultAsync();
- foreach (var a in roles)
- {
-
- if (a.RoleName.Contains(myS) && status == "In Progress")
- {
- return RedirectToPage("/WO/WOReport", new { womainid = womainid });
- }
- else
- {
- var womainidP = await _context.WOMains.Where(s => s.WONumber == won && s.WONumberS == 0).Select(s => s.WOMainID).FirstOrDefaultAsync();
- return RedirectToPage("/WO/WOForm", new { womainid = womainidP, woS = womainid, status = WOStatusT });
- }
- }
the user can have multiple roles, however, WOCraftTL is assigned, I verified that and the status for one specific item is "In Progress" but when I run the program the if doesn't work, always else is activated. What am I doing wrong?