public async Task TestPage(string siteUrl, string url) { var responseTime = responseTimeTester.Test(url); var site = await repo.GetTestedSiteAsync(siteUrl); var page = site.Pages.SingleOrDefault(item => item.Url == url); if (page == null) { page = new TestedPage { Url = url, Site = site, Results = new List <TestResult>() }; repo.AddTestedPage(page); if (!await repo.SaveAllAsync()) { throw new Exception("Save error"); } } page.Results.Add(new TestResult(responseTime, page)); repo.Update(page); if (!await repo.SaveAllAsync()) { throw new Exception("Save error"); } }
public IActionResult Edit([FromForm] Tests test) { if (ModelState.IsValid) { //update from server first _testRepository.Update(test); _testRepository.Save(); return(RedirectToAction(nameof(Index), new { id = test.ProblemId })); } return(View()); }
public Test Update(Test test) { return(_testsRepository.Update(test)); }