public ActionResult EditSoftwareType(string id) { var swTypeRepo = new SoftwareTypeRepository(); var swType = swTypeRepo.GetById(Guid.Parse(id)); return(View(swType)); }
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 async Task <ActionResult> TesterTests(int?page, Guid?swTypeGuid, Guid?testCatGuid, string searchTerm) { TestCaseRepository testCaseRepo = new TestCaseRepository(); ApplicationUserRepository <Tester> userRepo = new ApplicationUserRepository <Tester>(); var testerTask = userRepo.GetByUserNameAsync(User.Identity.Name); SoftwareTypeRepository swTypeRepo = new SoftwareTypeRepository(); ViewBag.SoftTypes = swTypeRepo.GetAllValid(); TestCategoryRepository testCatRepo = new TestCategoryRepository(); ViewBag.TestCategories = testCatRepo.GetAllValid(); 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 <TestCase> testCases = testCaseRepo.GetAvailableEntities(out var totalTests, DateTime.Today, await testerTask, swType, testCat, startIndex, itemsOnPage, searchTerm); ViewBag.Pages = (int)Math.Ceiling((double)totalTests / (double)itemsOnPage); ViewBag.CurrentPage = pg; if (Request.IsAjaxRequest()) { return(PartialView(testCases)); } return(View(testCases)); }
public ActionResult ToggleValidSoftwareType(IList <SoftwareType> rows) { var swTypeRepo = new SoftwareTypeRepository(); foreach (var row in rows) { var swType = swTypeRepo.GetById(row.Id); if (swType.Valid) { swType.Valid = false; } else if (!swType.Valid) { swType.Valid = true; } swTypeRepo.Update(swType); } TempData["success"] = "Software type/s was updated!"; return(View("SoftwareTypes")); }
public ActionResult DeleteSoftwareType(IList <SoftwareType> rows) { var swTypeRepo = new SoftwareTypeRepository(); foreach (var row in rows) { var swType = swTypeRepo.GetById(row.Id); try { swTypeRepo.Delete(swType); } catch (Exception e) { TempData["error"] = "Software type/s can't be delete, because it used in some part of system!"; return(View("SoftwareTypes")); } } TempData["success"] = "Software type/s was deleted!"; return(View("SoftwareTypes")); }