public async Task DeleteGlossaryTerm(int id) { GlossaryTerm glossaryTerm = await _dataRepository.Get(id); if (glossaryTerm == null) { throw new Exception("The term record couldn't be found."); } await _dataRepository.Delete(glossaryTerm); }
public ActionResult DeleteConfirmed(int id, string confirmText) { var term = _termRepository.Find(id); var success = false; string error = ""; if (term == null) { error = "Không tìm thấy kỳ hạn"; } else if (confirmText.ToLower() != "đồng ý") { error = "Chuỗi nhập vào chưa đúng"; } else { _termRepository.Delete(id); _termRepository.Save(); success = true; } return(Json(new { success = success, id = id, error = error })); }