public void DeleteTest(int testId) { using (Repo = new TestRepository()) { try { Repo.DeleteTest(testId); } catch (NullReferenceException ex) { throw; } catch (NotSupportedException ex) { } catch (ObjectDisposedException ex) { } catch (InvalidOperationException ex) { } catch (Exception ex) { } } }
public IActionResult DeleteTest(int id) { if (id == 0) { return(BadRequest("Please provide id")); } return(Ok(_iTest.DeleteTest(id))); }
public Test DeleteTest(int id) { Test test = Tests.FirstOrDefault(p => p.Id == id); if (test != null) { repository.DeleteTest(test); } return(test); }
public IActionResult DeleteTest(Guid testId) { var deleteTest = testRepository.FindTest(testId); if (deleteTest == null) { return(NotFound()); } testRepository.DeleteTest(deleteTest); return(RedirectToAction("dashboard", "examiner")); }
public async Task <IActionResult> DeleteTest([FromRoute] int testId) { if (!ModelState.IsValid) { return(BadRequest()); } if (!await _testRepository.IsTestExistAsync(testId)) { return(NotFound()); } await _testRepository.DeleteTest(testId); return(Ok(testId)); }
public ActionResult Edit(int?ID, int?Delete) { if (Delete == null) { TestPreview test = TestRepository.Tests.First(x => x.Id == ID); return(View(test)); } else { TestPreview test = TestRepository.Tests.First(x => x.Id == ID); TestPreview deletedTest = TestRepository.DeleteTest(test.Id); if (deletedTest != null) { TempData["message"] = string.Format("Тест \"{0}\" был удален", deletedTest.Theme); } return(RedirectToAction("Index")); } }
public async Task <IActionResult> Delete(int id) { try { if ((await _repository.GetTest(id)).UserId != User.FindFirst(ClaimTypes.NameIdentifier)?.Value && !User.IsInRole("Admin")) { return(new UnauthorizedResult()); } if (!await _repository.DeleteTest(id)) { throw new Exception($"Error during deleting test ith id: {id}"); } await _hubContext.Clients.All.TestRemoved(id); return(new NoContentResult()); } catch (Exception e) { return(new StatusCodeResult(500)); } }
public void DeleteTest(int testId) { testRepository.DeleteTest(testId); }
public bool DeleteTest(int position, string fileName) { return(_testRepository.DeleteTest(position, fileName)); }
public void DeleteTest(int id) { _testRepository.DeleteTest(id); }
public int DeleteTest(int id) { return(testRepository.DeleteTest(id)); }
public IHttpActionResult Delete(Guid id) { testRepository.DeleteTest(id); return(Ok()); }