private void RemoveUser() { _userService.Delete(user); _lecturerService.Delete(lecturer); PopulateListLecturer(); MMessageBox.ShowMessage("Deleted Staff From system.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btnDeleteStudent_Click(object sender, EventArgs e) { int lecturerId = (int)dgwLecturers.CurrentRow.Cells["Id"].Value; var currentLecturer = _lecturerService.GetAll().SingleOrDefault(p => p.Id == lecturerId); if (currentLecturer != null) { _lecturerService.Delete(currentLecturer); LoadLecturers(); } }
public JsonResult Delete(int id = 0) { try { var entity = _LecturerService.GetById(id); if (entity == null) { return(Json(new { Status = Successed.Empty }, JsonRequestBehavior.AllowGet)); } _LecturerService.Delete(entity); return(Json(new { Status = Successed.Ok }, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new { Status = Successed.Error }, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult <LecturerViewModel> > DeleteLecturer(int id) { var lecturer = _lecturerService.GetById(id); if (lecturer == null) { return(NotFound("Không tìm thấy Id = " + id)); } try { await Task.Run(() => { _lecturerService.Delete(id); _lecturerService.SaveChanges(); }); } catch { throw new Exception(string.Format("Có lỗi xảy ra không thể xóa!")); } return(Ok()); }
public bool Delete(Guid LecturerId) { return(LecturerService.Delete(UserEntity, LecturerId)); }
public async Task <ResponseModel> Delete([FromBody] LecturerModel model) { var response = await _lecturerService.Delete(model); return(response); }
public async Task <ActionResult> Delete(int id) { var result = await _lecturerService.Delete(id); return(Ok(result)); }