public LmPlatformRepositoriesContainer() { UsersRepository = new UsersRepository(_dataContext); BugsRepository = new BugsRepository(_dataContext); BugLogsRepository = new BugLogsRepository(_dataContext); GroupsRepository = new GroupsRepository(_dataContext); ProjectsRepository = new ProjectsRepository(_dataContext); ProjectUsersRepository = new ProjectUsersRepository(_dataContext); ProjectCommentsRepository = new ProjectCommentsRepository(_dataContext); StudentsRepository = new StudentsRepository(_dataContext); SubjectRepository = new SubjectRepository(_dataContext); TestsRepository = new TestsRepository(_dataContext); TestUnlocksRepository = new TestUnlockRepository(_dataContext); QuestionsRepository = new QuestionsRepository(_dataContext); UsersRepository = new UsersRepository(_dataContext); ModulesRepository = new ModulesRepository(_dataContext); LecturerRepository = new LecturerRepository(_dataContext); MessageRepository = new MessageRepository(_dataContext); MaterialsRepository = new MaterialsRepository(_dataContext); FoldersRepository = new FoldersRepository(_dataContext); SubGroupRepository = new SubGroupRepository(_dataContext); AttachmentRepository = new AttachmentRepository(_dataContext); LecturesRepository = new LecturesRepository(_dataContext); LabsRepository = new LabsRepository(_dataContext); ProjectUsersRepository = new ProjectUsersRepository(_dataContext); PracticalRepository = new PracticalRepository(_dataContext); ConceptRepository = new ConceptRepository(_dataContext); WatchingTimeRepository = new WatchingTimeRepository(_dataContext); TestQuestionPassResultsRepository = new TestQuestionPassResultsRepository(_dataContext); //todo UNUSED ProjectMatrixRequirementsRepository = new ProjectMatrixRequirementsRepository(_dataContext); }
public PagePatient(Patient _patient) { InitializeComponent(); if (_patient != null) { patient = _patient; modification = true; } else { patient = new Patient(null, null, false, DateTime.Now, null, null, null); modification = false; int id = PatientRepository.nouveauPatient(patient, -1); Tests tests = new Tests(); TestsRepository.nouveauxTests(patient.PatientId, tests); patient.PatientId = id; } PopUpContact.IdPatientActuel = patient.PatientId; InitialisationComposants(); Patient.Measure(new System.Windows.Size(double.PositiveInfinity, double.PositiveInfinity)); Patient.Arrange(new Rect(0, 0, Patient.DesiredSize.Width, Patient.DesiredSize.Height)); Fraterie.Width = GridTabControl.ColumnDefinitions[0].ActualWidth; Parents.Width = Arbre.ActualWidth; GrandsParents.Width = Arbre.ActualWidth; currentProche = new Proche("", "", 0, true, "", false, true, false); }
public void Given_Test_When_UpdateTestAsync_Then_ShouldBeTrue() { RunOnDatabase(context => { // ARRANGE context.Roles.Add(Role.Create("student")); context.SaveChanges(); var userType = context.Roles.FirstOrDefault(); if (userType != null) { context.Users.Add(User.Create( "John", "Mark", "john.mar", "*****@*****.**", "password" ) ); } context.SaveChanges(); var user = context.Users.FirstOrDefault(); context.TestTypes.Add(TestType.Create("grila")); context.SaveChanges(); var testType = context.TestTypes.FirstOrDefault(); var testsRepository = new TestsRepository(context); if (user == null) { return; } if (testType == null) { return; } var test = Test.Create( "mytest", "descriere", user.Id, testType.Id ); context.Add(test); context.SaveChanges(); test.Update("test2", "descrierile", user.Id, testType.Id, false); // ACT var result = testsRepository.UpdateAsync(test); // ASSERT result.Result.Should().Be(true); }); }
public ActionResult FinishedTests(int?page, Guid?swTypeGuid, Guid?testCatGuid, string searchTerm) { TestsRepository testsRepo = new TestsRepository(); SoftwareTypeRepository swTypeRepo = new SoftwareTypeRepository(); ViewBag.SoftTypes = swTypeRepo.GetAllValid(); TestCategoryRepository testCatRepo = new TestCategoryRepository(); ViewBag.TestCategories = testCatRepo.GetAllValid(); ApplicationUserRepository <Tester> userRepo = new ApplicationUserRepository <Tester>(); Tester tester = userRepo.GetByUserName(User.Identity.Name); int itemsOnPage = 8; int pg = page ?? 1; int startIndex = (pg * itemsOnPage) - itemsOnPage; SoftwareType swType = null; if (swTypeGuid != null) { swType = swTypeRepo.GetById((Guid)swTypeGuid); ViewBag.SoftType = swType; } TestCategory testCat = null; if (testCatGuid != null) { testCat = testCatRepo.GetById((Guid)testCatGuid); ViewBag.TestCategory = testCat; } ViewBag.CurrentSearch = searchTerm; IList <TestsStatus> statuses = new List <TestsStatus>(); statuses.Add(TestsStatus.Finished); statuses.Add(TestsStatus.Reviewed); IList <DataAccess.Model.Tests.Tests> tests = testsRepo.GetAvailableEntities(out var totalTests, tester, statuses, swType, testCat, startIndex, itemsOnPage, searchTerm); ViewBag.Pages = (int)Math.Ceiling((double)totalTests / (double)itemsOnPage); ViewBag.CurrentPage = pg; if (Request.IsAjaxRequest()) { return(PartialView(tests)); } return(View(tests)); }
public void Given_Tests_When_GetTestsAsyncIsCalled_Then_ShouldReturnZeroTests() { RunOnDatabase(context => { // ARRANGE var testRepository = new TestsRepository(context); // ACT var tests = testRepository.GetAllAsync(); var counter = tests.Result.Count; // ASSERT counter.Should().Be(0); }); }
public HomeController(IHttpContextAccessor httpContextAccessor) { _categoriesRepository = new CategoriesRepository(); _wordsRepository = new WordsRepository(); _testsRepository = new TestsRepository(); string userLogin = httpContextAccessor?.HttpContext?.User?.FindFirst("userLogin")?.Value; if (userLogin != null) { _currentUser = new UsersRepository().GetByEmailOrName(userLogin); } }
public void Given_Test_When_NewTestIsAdded_Then_ShouldHaveOneTestInDatabase() { RunOnDatabase(context => { // ARRANGE context.Roles.Add(Role.Create("student")); context.SaveChanges(); var userType = context.Roles.FirstOrDefault(); if (userType != null) { context.Users.Add(User.Create( "John", "Mark", "john.mar", "*****@*****.**", "password" ) ); } context.SaveChanges(); var user = context.Users.FirstOrDefault(); context.TestTypes.Add(TestType.Create("grila")); context.SaveChanges(); var testType = context.TestTypes.FirstOrDefault(); var testsRepository = new TestsRepository(context); if (user == null) { return; } if (testType == null) { return; } var test = Test.Create( "mytest", "descriere", user.Id, testType.Id ); var testInserted = testsRepository.InsertAsync(test).Result; // ACT var result = testsRepository.GetByIdAsync(testInserted.Id); // ASSERT result.Should().NotBe(null); }); }
public async Task <ActionResult> TestDetails(Guid testGuid) { TestCaseRepository testCaseRepo = new TestCaseRepository(); var testCaseTask = testCaseRepo.GetByIdAsync(testGuid); ApplicationUserRepository <Tester> userRepo = new ApplicationUserRepository <Tester>(); var testerTask = userRepo.GetByUserNameAsync(User.Identity.Name); TestsRepository testsRepo = new TestsRepository(); ViewBag.Takened = testsRepo.GetTestStatus(await testCaseTask, await testerTask); ViewBag.TestsGuid = testsRepo.GetByTestCaseForTester(await testerTask, await testCaseTask); return(View(await testCaseTask)); }
public TestDto CreateTest([FromBody] TestDto testDto) { TestDto savedTest = null; try { savedTest = new TestsRepository(_appDbContext).Add(testDto, _clientData); } catch (Exception e) { _log.LogError(e, "Error saving Test"); } return(savedTest); }
public async Task <IActionResult> Index(int subcategoryId) { int idToUse = subcategoryId; if (idToUse > 0) { _helper.SetSubcategory(subcategoryId); } TestsRepository testsRepository = new TestsRepository(); List <DTO> DTOs = await Task.Run(() => testsRepository.GetDTO(NativeLanguageId, LearningLanguageId)); return(View(DTOs)); }
public ActionResult TestsResaults(int?page, Guid?testCaseGuid, Guid?statusGuid) { TestsRepository testsRepo = new TestsRepository(); ApplicationUserRepository <Company> userRepo = new ApplicationUserRepository <Company>(); Company company = userRepo.GetByUserName(User.Identity.Name); TestCaseRepository testCaseRepo = new TestCaseRepository(); ViewBag.TestCases = testCaseRepo.GetAllForCompany(company); TestStatusRepository statusRepo = new TestStatusRepository(); ViewBag.Statuses = statusRepo.GetAll(); int itemsOnPage = 20; int pg = page ?? 1; int startIndex = (pg * itemsOnPage) - itemsOnPage; TestCase testCase = null; if (testCaseGuid != null) { testCase = testCaseRepo.GetById((Guid)testCaseGuid); ViewBag.TestCase = testCase; } TestStatus testStatus = null; if (statusGuid != null) { testStatus = statusRepo.GetById((Guid)statusGuid); ViewBag.Status = testStatus; } IList <DataAccess.Model.Tests.Tests> testses = testsRepo.GetTestsForCompany(company, out int totalTests, out int filteredCount, testCase, testStatus, startIndex, itemsOnPage); ViewBag.Pages = (int)Math.Ceiling((double)totalTests / (double)itemsOnPage); ViewBag.CurrentPage = pg; if (Request.IsAjaxRequest()) { return(PartialView(testses)); } return(View(testses)); }
public async Task <ActionResult> ResolveTest(Guid testGuid) { TestCaseRepository testCaseRepo = new TestCaseRepository(); var testCaseTask = testCaseRepo.GetByIdAsync(testGuid); ApplicationUserRepository <Tester> userRepo = new ApplicationUserRepository <Tester>(); var testerTask = userRepo.GetByUserNameAsync(User.Identity.Name); TestsRepository testsRepo = new TestsRepository(); var testsTask = testsRepo.GetByTestCaseForTesterAsync(await testerTask, await testCaseTask); TestStatusRepository testStatusRepo = new TestStatusRepository(); ViewBag.TestStatus = testStatusRepo.GetAll(); return(View(await testsTask)); }
public async Task TakeTest(Guid testGuid) { TestCaseRepository testCaseRepo = new TestCaseRepository(); var testCaseTask = testCaseRepo.GetByIdAsync(testGuid); ApplicationUserRepository <Tester> userRepo = new ApplicationUserRepository <Tester>(); var testerTask = userRepo.GetByUserNameAsync(User.Identity.Name); DataAccess.Model.Tests.Tests tests = new DataAccess.Model.Tests.Tests(); tests.Test = await testCaseTask; tests.Status = TestsStatus.Takened; tests.Takened = DateTime.Now; tests.Tester = await testerTask; TestsRepository testsRepo = new TestsRepository(); testsRepo.Create(tests); }
public async Task <ActionResult> ResolveGroup(Guid testGroupGuid) { TestGroupsRepository testGroupsRepo = new TestGroupsRepository(); var testGroups = testGroupsRepo.GetById(testGroupGuid); ApplicationUserRepository <Tester> userRepo = new ApplicationUserRepository <Tester>(); var testerTask = userRepo.GetByUserNameAsync(User.Identity.Name); TestsRepository testsRepo = new TestsRepository(); IList <DataAccess.Model.Tests.Tests> tests = new List <DataAccess.Model.Tests.Tests>(); foreach (var testCase in testGroups.TestGroup.TestCases) { DataAccess.Model.Tests.Tests testsRecord = testsRepo.GetByTestCaseForTesterByStatus(await testerTask, testCase, TestsStatus.Takened); if (testsRecord != null) { tests.Add(testsRecord); } } if (tests.Count <= 0) { testGroups.Finished = DateTime.Now; testGroups.Status = GroupStatus.Finished; testGroups.TestGroup.Rating = testGroups.TestGroup.CountRating(); testGroupsRepo.Update(testGroups); return(RedirectToAction("FinishedTestGroups")); } TestStatusRepository testStatusRepo = new TestStatusRepository(); ViewBag.TestStatus = testStatusRepo.GetAll(); ViewBag.TestGroup = testGroups.TestGroup.Name; ViewBag.TestGroupsGuid = testGroups.Id; return(View(tests.First())); }
//================= SUIVI ================= private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox combobox = (ComboBox)sender; ComboBoxItem typeItem = (ComboBoxItem)combobox.SelectedItem; string value = typeItem.Content.ToString(); switch (combobox.Name) { case "OrigineDemande": TestsRepository.updateOrigineDemandeTests(patient.PatientId, value); break; case "Acuite": TestsRepository.updateAcuiteTests(patient.PatientId, value); break; case "Orthoptie": TestsRepository.updateOrthoptieTests(patient.PatientId, value); break; case "ReflexeVisuel": TestsRepository.updateReflexeTests(patient.PatientId, value); break; case "TestLateralite": TestsRepository.updateLateraliteTests(patient.PatientId, value); break; case "ConnaissanceLateralite": TestsRepository.updateConnaissanceLateraliteTests(patient.PatientId, value); break; case "Pattes": TestsRepository.updatePattesTests(patient.PatientId, value); break; } }
public async Task TakeGroup(Guid groupId) { TestGroupRepository testGroupRepo = new TestGroupRepository(); var testGroupTask = testGroupRepo.GetByIdAsync(groupId); ApplicationUserRepository <Tester> userRepo = new ApplicationUserRepository <Tester>(); var testerTask = userRepo.GetByUserNameAsync(User.Identity.Name); TestGroups testGroups = new TestGroups(); testGroups.TestGroup = await testGroupTask; testGroups.Status = GroupStatus.Takened; testGroups.Takened = DateTime.Now; testGroups.Tester = await testerTask; TestGroup testGroup = await testGroupTask; TestsRepository testsRepo = new TestsRepository(); foreach (var testCase in testGroup.TestCases) { if (!testsRepo.IsTestTakened(testCase, await testerTask)) { DataAccess.Model.Tests.Tests tests = new DataAccess.Model.Tests.Tests(); tests.Test = testCase; tests.Status = TestsStatus.Takened; tests.Takened = DateTime.Now; tests.Tester = await testerTask; testsRepo.Create(tests); } } TestGroupsRepository testGroupsRepo = new TestGroupsRepository(); testGroupsRepo.Create(testGroups); }
public async Task <ActionResult> CreateReview(Review review, Guid testsGuid) { ModelState.Remove("testsGuid"); ModelState.Remove(nameof(Review.Id)); ModelState.Remove(nameof(Review.Created)); ModelState.Remove(nameof(Review.Creator)); if (ModelState.IsValid) { TestsRepository testsRepo = new TestsRepository(); var testsTask = testsRepo.GetByIdAsync(testsGuid); ApplicationUserRepository <Tester> userRepo = new ApplicationUserRepository <Tester>(); var testerTask = userRepo.GetByUserNameAsync(User.Identity.Name); review.Created = DateTime.Now; review.Creator = await testerTask; DataAccess.Model.Tests.Tests tests = await testsTask; tests.Test.Reviews.Add(review); tests.Test.CountRating(); tests.Status = TestsStatus.Reviewed; ReviewRepository reviewRepo = new ReviewRepository(); reviewRepo.Create(review); testsRepo.Update(tests); return(RedirectToAction("FinishedTests")); } ViewBag.TestsGuid = testsGuid; return(View("AddReview", review)); }
private StatisticViewModel FillResults(StatisticViewModel model) { StatisticViewModel result = new StatisticViewModel { LanguageName = model.LanguageName, LanguageId = model.LanguageId, CategoryStatistics = model.CategoryStatistics }; int langId = result.LanguageId; TestsResultsRepository testsResultsRepository = new TestsResultsRepository(); TestsRepository testsRepository = new TestsRepository(); IEnumerable <TestResults> testResults = testsResultsRepository.GetAll(); IEnumerable <Tests> tests = testsRepository.GetAll(); IEnumerable <TestResults> userTests; try { userTests = testResults.Where(t => t.UserId == this.UserId).ToArray(); } catch (InvalidOperationException) { userTests = null; } catch (Exception e) { Console.WriteLine(e); throw; } int categoriesCount = result.CategoryStatistics.Count; int testsCount = tests.Count(); for (int i = 0; i < categoriesCount; i++) { int subcategoriesCount = result.CategoryStatistics.ElementAt(i).SubcategoryStatistics.Count(); for (int j = 0; j < subcategoriesCount; j++) { SubcategoryStatistic subcategoryStatistic = result.CategoryStatistics[i].SubcategoryStatistics[j]; List <int> subcategoryScore = new List <int>(); for (int k = 0; k < testsCount; k++) { int score; if (userTests != null) { bool isScore = userTests.ToList().Exists(t => t.CategoryId == subcategoryStatistic.CategoryId && t.LangId == langId && t.TestId == k + 1); if (isScore) { score = userTests.First(t => t.CategoryId == subcategoryStatistic.CategoryId && t.LangId == langId && t.TestId == k + 1).Result; } else { score = 0; } } else { score = 0; } subcategoryScore.Add(score); } subcategoryStatistic.TestsScore = subcategoryScore; } } return(result); }
public async Task <ActionResult> Resolve(DataAccess.Model.Tests.Tests tests, HttpPostedFileBase[] files) { TestsRepository testsRepo = new TestsRepository(); DataAccess.Model.Tests.Tests testsRecord = testsRepo.GetById(tests.Id); TestStatusRepository testStatusRepo = new TestStatusRepository(); ModelState.Remove("files"); ModelState.Remove(nameof(DataAccess.Model.Tests.Tests.Tester)); ModelState.Remove(nameof(DataAccess.Model.Tests.Tests.Status)); ModelState.Remove(nameof(DataAccess.Model.Tests.Tests.Test)); ModelState.Remove(nameof(DataAccess.Model.Tests.Tests.Evidences)); ModelState.Remove(nameof(DataAccess.Model.Tests.Tests.Finished)); ModelState.Remove(nameof(DataAccess.Model.Tests.Tests.Rejected)); ModelState.Remove(nameof(DataAccess.Model.Tests.Tests.Takened)); ModelState.Remove("TestStatus.Status"); if (ModelState.IsValid) { if (testsRecord.Test.Creator.Credits < testsRecord.Test.Reward) { ViewBag.TestStatus = testStatusRepo.GetAll(); TempData["error"] = "Createor of tests don't have required amount of coins. Please try resolve test later, or contact our support team."; return(View("TakenedTests")); } var testStatusTask = testStatusRepo.GetByIdAsync(tests.TestStatus.Id); IList <Evidence> evidences = new List <Evidence>(); if (files[0] != null) { var maxSizeInMb = 20; var byteSize = 1048576; var maxSizeInBytes = byteSize * maxSizeInMb; foreach (var file in files) { if (file.ContentLength > maxSizeInBytes) { TempData["error"] = "File " + file.FileName + " is too big! (max size is " + maxSizeInMb + "MB)"; ViewBag.TestStatus = testStatusRepo.GetAll(); return(View("ResolveTest", testsRecord)); } } foreach (var file in files) { Evidence evidence = new Evidence(); evidence.Id = Guid.NewGuid(); evidence.Name = evidence.Id.ToString(); evidence.RealName = Path.GetFileNameWithoutExtension(file.FileName); evidence.Attached = DateTime.Now; var extension = Path.GetExtension(file.FileName); evidence.Extension = extension; var path = Path.Combine(Server.MapPath($"~/Uploads/{testsRecord.Id}"), evidence.Name + extension); Directory.CreateDirectory(Server.MapPath($"~/Uploads/{testsRecord.Id}")); file.SaveAs(path); evidences.Add(evidence); } testsRecord.Evidences = evidences; } testsRecord.TestStatus = await testStatusTask; testsRecord.Finished = DateTime.Now; testsRecord.Status = TestsStatus.Finished; testsRecord.Tester.Credits = testsRecord.Tester.Credits + testsRecord.Test.Reward; testsRecord.Test.Creator.Credits = testsRecord.Test.Creator.Credits - testsRecord.Test.Reward; EvidenceRepository evidRepo = new EvidenceRepository(); foreach (var evidence in evidences) { evidRepo.Create(evidence); } testsRepo.Update(testsRecord); return(RedirectToAction("FinishedTests")); } ViewBag.TestStatus = testStatusRepo.GetAll(); return(View("ResolveTest", testsRecord)); }
public TestsService(TestsRepository repository) { this.repository = repository; }
//================= INFORMATIONS GENERALES ================= public void InitialisationComposants() { Id.Content = patient.PatientId.ToString(); if (modification == true) { TextBox1.Text = patient.PatientNom; TextBox2.Text = patient.PatientPrenom; FlowDocument myFlowDoc = new FlowDocument(); Run myRun = new Run(patient.Commentaire); Paragraph myParagraph = new Paragraph(); myParagraph.Inlines.Add(myRun); myFlowDoc.Blocks.Add(myParagraph); Commentaire.Document = myFlowDoc; DatePickerNaissance.SelectedDate = patient.PatientNaissance; DatePickerJour.SelectedDate = patient.PatientDateBilan; TextBlockAffichageAge.Content = (DateTime.Now.Year - patient.PatientNaissance.Year).ToString() + " ans " + (DateTime.Now.Month - patient.PatientNaissance.Month).ToString() + " mois "; var contacts = ContactRepository.getContactsPatient(patient.PatientId); foreach (Contact contact in contacts) { creerGridContact(contact.ContactDesignation, contact.ContactTelephone, contact.ContactMail); } var adresses = AdresseRepository.getAdressesPatient(patient.PatientId); foreach (Adresse adresse in adresses) { creerGridAdresse(adresse.AdresseDesignation, adresse.AdresseRue, adresse.AdresseCP, adresse.AdresseVille); } if (DatePickerJour.SelectedDate != null && DatePickerNaissance.SelectedDate != null && (DateTime)DatePickerNaissance.SelectedDate != DateTime.MinValue) { TextBlockAffichageAge.Content = calculerAge((DateTime)DatePickerNaissance.SelectedDate, (DateTime)DatePickerJour.SelectedDate); } Tests tests = TestsRepository.getTestsPatient(patient.PatientId); if (tests != null) { OrigineDemande.Text = tests.OrigineDemande; Acuite.Text = tests.Acuite; Orthoptie.Text = tests.Orthoptie; ReflexeVisuel.Text = tests.Reflexe; TestLateralite.Text = tests.Lateralite; ConnaissanceLateralite.Text = tests.ConnaissanceLateralite; Pattes.Text = tests.Pattes; } var suivis = SuiviRepository.getSuivisPatient(patient.PatientId); if (suivis != null) { foreach (Suivi suivi in suivis) { Specialiste specialiste = SpecialisteRepository.getSpecialiste(suivi.SpecialisteId); creerGridSuivis(specialiste, suivi.Debut, suivi.Fin); } } } else { DatePickerJour.SelectedDate = DateTime.Now; } }
// GET: Testing/Home public async Task <ActionResult> Index() { if (User.IsInRole("company")) { ViewBag.Role = "company"; ApplicationUserRepository <Company> companyRepo = new ApplicationUserRepository <Company>(); TestCaseRepository testCaseRepo = new TestCaseRepository(); TestGroupRepository testGroupRepo = new TestGroupRepository(); DisputeRepository disputeRepo = new DisputeRepository(); Company company = companyRepo.GetByUserName(User.Identity.Name); var tests = testCaseRepo.GetCountForCompanyAsync(company); var testGroups = testGroupRepo.GetCountForCompanyAsync(company); var disputes = disputeRepo.GetCountWithCompanyAsync(company); ViewBag.Credits = company.Credits; ViewBag.Tests = await tests; ViewBag.TestGroups = await testGroups; ViewBag.Disputes = await disputes; } if (User.IsInRole("tester")) { ViewBag.Role = "tester"; ApplicationUserRepository <Tester> testerRepo = new ApplicationUserRepository <Tester>(); DisputeRepository disputeRepo = new DisputeRepository(); TestsRepository testRepo = new TestsRepository(); var tester = testerRepo.GetByUserName(User.Identity.Name); var dispute = disputeRepo.GetCountWithTesterAsync(tester); IList <TestsStatus> takened = new List <TestsStatus>(); takened.Add(TestsStatus.Takened); IList <TestsStatus> finished = new List <TestsStatus>(); finished.Add(TestsStatus.Finished); finished.Add(TestsStatus.Reviewed); ViewBag.Credits = tester.Credits; ViewBag.Disputes = await dispute; ViewBag.ResolvedTests = testRepo.GetCountByStatus(finished, tester); ViewBag.TakenedTests = testRepo.GetCountByStatus(takened, tester); } if (User.IsInRole("admin")) { ViewBag.Role = "admin"; ApplicationUserRepository <Admin> adminRepo = new ApplicationUserRepository <Admin>(); DisputeRepository disputeRepo1 = new DisputeRepository(); DisputeRepository disputeRepo2 = new DisputeRepository(); DisputeRepository disputeRepo3 = new DisputeRepository(); SoftwareTypeRepository swTypeRepo = new SoftwareTypeRepository(); TestCaseRepository testCatRepo = new TestCaseRepository(); Admin admin = adminRepo.GetByUserName(User.Identity.Name); var disputes = disputeRepo1.GetCountPandingAsync(); var inProgressDisputes = disputeRepo2.GetCountForAdminInProgressAsync(admin); var resolvedDisputes = disputeRepo3.GetCountForAdminResolvedAsync(admin); var admins = adminRepo.GetCountAsync(); var softwareTypes = swTypeRepo.GetCountAsync(); var testCategories = testCatRepo.GetCountAsync(); ViewBag.Disputes = await disputes; ViewBag.InProgressDisputes = await inProgressDisputes; ViewBag.ResolvedDisputes = await resolvedDisputes; ViewBag.Admins = await admins; ViewBag.SoftwareTypes = await softwareTypes; ViewBag.TestCategories = await testCategories; } return(View()); }