private void RemoveUser()
 {
     _userService.Delete(user);
     _lecturerService.Delete(lecturer);
     PopulateListLecturer();
     MMessageBox.ShowMessage("Deleted Staff From system.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Beispiel #2
0
        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();
            }
        }
Beispiel #3
0
        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));
            }
        }
Beispiel #4
0
        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());
        }
Beispiel #5
0
 public bool Delete(Guid LecturerId)
 {
     return(LecturerService.Delete(UserEntity, LecturerId));
 }
Beispiel #6
0
        public async Task <ResponseModel> Delete([FromBody] LecturerModel model)
        {
            var response = await _lecturerService.Delete(model);

            return(response);
        }
Beispiel #7
0
        public async Task <ActionResult> Delete(int id)
        {
            var result = await _lecturerService.Delete(id);

            return(Ok(result));
        }