public IActionResult Index() { var claimsIdentity = (ClaimsIdentity)User.Identity; /*var claim = claimsIdentity.FindFirst(ClaimTypes.Email);*/ var claim = claimsIdentity.Claims.ToArray(); var email = claim[1].Value; var userid = User.Claims.FirstOrDefault(c => c.Type == AppUtility.UserId).Value; //User.Claims.FirstOrDefault(c => c.Type == AppUtility.UserId).Value;; var user = _users.FindById(userid.ToString()); var issuers = _issuer.AsQueryable().ToList(); var issuer = issuers.Where(e => e.UserId == new ObjectId(userid)).FirstOrDefault(); var pathway = _path.AsQueryable().ToList(); var userSpecificPathway = pathway.Where(e => e.IssuersId == issuer.Id); var pathwaySteps = _peopleRepository.AsQueryable().ToList(); //PathwaySteps p = new PathwaySteps() //{ // Id = new ObjectId("5efb275c3cee0204d801e303"), //}; //var enumerable = new[] { p }; PathwayVM pathwayVM = new PathwayVM() { pathways = userSpecificPathway, pathwaySteps = pathwaySteps }; return(View(pathwayVM)); }
public IActionResult Index(int productPage = 1) { var claimsIdentity = (ClaimsIdentity)User.Identity; var claim = claimsIdentity.Claims.ToArray(); var email = claim[1].Value; var userid = User.Claims.FirstOrDefault(c => c.Type == AppUtility.UserId).Value; var pathwaySteps = _pathSteps.AsQueryable().ToList(); var cr = _checkRequest.AsQueryable().ToList(); var cr1 = cr.Where(e => e.UserId == new ObjectId(userid.ToString())); var issuers = _issuer.AsQueryable().Where(e => e.StaffsIds.Contains(userid)).ToList(); List <string> allissuerid = new List <string>(); List <Pathways> validPathways = new List <Pathways>(); var pathway = _path.AsQueryable().ToList(); foreach (var item in issuers) { allissuerid.Add(item.Id.ToString()); } //var issuerid = allissuerid.ToString(); foreach (var path in pathway) { if (allissuerid.Contains(path.IssuersId.ToString())) { var totalSteps = pathwaySteps.AsQueryable().Where(e => e.PathwayId == path.Id.ToString()).Count(); var completedSteps = cr1.AsQueryable().Where(e => (e.PathwayId == path.Id && e.IsApproved == true)).Count(); var completedPercentage = (totalSteps != 0) ? ((completedSteps * 100) / totalSteps):0; path.PathwayCompletion = completedPercentage; validPathways.Add(path); } } PathwayVM pathwayVM = new PathwayVM() { pathways = validPathways, pathwaySteps = pathwaySteps, checkRequests = cr1 }; var count = pathwayVM.pathways.Count(); pathwayVM.pathways = pathwayVM.pathways.OrderBy(p => p.PathwayName) .Skip((productPage - 1) * 2).Take(2).ToList(); pathwayVM.PagingInfo = new PagingInfo { CurrentPage = productPage, ItemsPerPage = 2, TotalItems = count, urlParam = "/Employee/PathwayEarner/Index?productPage=:" }; return(View(pathwayVM)); }
public IActionResult Step(string id) { CheckRequest check = _checkRequest.FindById(id); PathwaySteps pathway = new PathwaySteps() { Id = check.PathwayStepId }; List <PathwaySteps> all = _pathSteps.AsQueryable().ToList(); List <PathwaySteps> list = all.Where(e => e.Id == pathway.Id).ToList(); PathwayVM pathwayVM = new PathwayVM() { pathwaySteps = list }; ViewBag.checkRequestId = id; return(View(pathwayVM)); }