public async Task <ActionResult> Delete(SiteTest model) { if (await _repo.GetByKeyAsync(model.Id) == null) { return(new HttpNotFoundResult()); } await _repo.DeleteAsync(model); return(RedirectToAction("Index")); }
///////////////////////////////////////////////////////////////////// // Run /// <summary> /// The main processing function. /// </summary> ///////////////////////////////////////////////////////////////////// private static bool Run(string[] arguments) { bool result; try { StartUp(); result = ValidateArguments(arguments); if (true == result) { string command = GetCommand(arguments); string url = GetUrl(arguments); DocumentChecks tests = GetTests(command); using SiteTest tester = new SiteTest(tests); string message = StringTable.GetString( "RUNNING_TESTS", CultureInfo.InstalledUICulture); Log.InfoFormat(CultureInfo.CurrentCulture, message, url); Uri uri = new Uri(url); tester.Test(uri); } else { ShowHelp(null); } } catch (Exception exception) { Log.Error(CultureInfo.InvariantCulture, m => m( exception.ToString())); throw; } return(result); }
public ActionResult Edit(VMSiteTest model) { var isArchitect = User.IsInRole("architect"); var isNew = model.Id == 0; if (isNew || (!isNew && string.IsNullOrEmpty(model.TitleUrl))) { model.TitleUrl = Url.SeoFriendlyUrl(model.Title); } var redactModel = Mapper.Map <VMSiteTest, SiteTest>(model); if (ModelState.IsValid) { SiteTest newModel = null; if (isNew) { newModel = _repo.Create(redactModel); } else { if (isArchitect) { newModel = _repo.Update(redactModel, true, "Title", "Description", "Rules", "Type", "TitleUrl", "Show", "ShowSubjectDesc", "ViewOnMainPage"); } else { newModel = _repo.Update(redactModel, true, "Title", "Description", "Rules", "Show", "ShowSubjectDesc", "ViewOnMainPage"); } } return(RedirectToAction("Index")); } else { return(View(model)); } }
public async Task<ActionResult> Delete(SiteTest model) { if (await _repo.GetByKeyAsync(model.Id) == null) return new HttpNotFoundResult(); await _repo.DeleteAsync(model); return RedirectToAction("Index"); }