public IActionResult Users() { if (!RoleHelper.UserIsAdmin(_database, User)) { return(RedirectToAction("Index", "Home")); } var identityUsers = _database.AspNetUsers.ToList(); var userInfos = new List <UserInfoModel>(); foreach (var user in identityUsers) { try { userInfos.Add(RoleHelper.GetUserInfo(_database, Guid.Parse(user.Id))); } catch (Exception ex) { LoggingUtil.AddException(ex); } } var viewModel = new UsersViewModel { UserInfos = _database.UserInfos.ToList(), Roles = _database.Roles.ToList() }; return(View(viewModel)); }
public string GetScorecardName(Guid id) { try { return(Scorecards.FirstOrDefault(sc => sc.ID == id).Name); } catch (Exception ex) { LoggingUtil.AddException(ex); return(""); } }
public string GetProgress(Guid id) { try { var progress = ScorecardsInProgress.FirstOrDefault(p => p.ID == id); var scorecard = Scorecards.FirstOrDefault(s => s.ID == progress.ScorecardID); return(Utils.GetPercentageString(progress.GetResults().Count(), scorecard.Tests.Count())); } catch (Exception ex) { LoggingUtil.AddException(ex); return("error"); } }
public string GetResultsScore(Guid id) { try { var results = Results.FirstOrDefault(r => r.ID == id); var passed = results.GetTestResults().Where(r => r.Passed == true); return(Utils.GetPercentageString(passed.Count(), results.TotalTestCount)); } catch (Exception ex) { LoggingUtil.AddException(ex); return("error"); } }