public async Task <IActionResult> Delete(string id) { if (await testsService.Delete(id)) { return(Ok()); } else { return(BadRequest()); } }
public IActionResult Delete(int id) { try { //cache string key = string.Format("TestId {0}", id); cache.Remove(key); var adminIdKey = this.userManager.GetUserId(HttpContext.User); cache.Remove(adminIdKey); tests.Delete(id); TempData["Success-Message"] = "You successfully deleted a test!"; } catch (InvalidTestException ex) { TempData["Error-Message"] = string.Format("Deleting test failed! {0}", ex.Message); } return(Json(Url.Action("Index", "Dashboard", new { area = "Administration" }))); }
public async Task Delete([FromUri] string id) { await _testsService.Delete(id).ConfigureAwait(false); }