public bool SelectedDelete(string ids)
 {
     try
     {
         if (!string.IsNullOrEmpty(ids))
         {
             if (ids.StartsWith(","))
             {
                 ids = ids.Remove(0, 1);
             }
             if (ids.EndsWith(","))
             {
                 ids = ids.Remove(ids.Length - 1, 1);
             }
             var silinecekler = ids.Split(',');
             for (int i = 0; i < silinecekler.Length; i++)
             {
                 _ExamService.Delete(Convert.ToInt32(silinecekler[i]));
             }
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Exemple #2
0
        public IActionResult ExamDelete(int id)
        {
            if (id != 0)
            {
                Exam deletedExam = _examService.GetById(id);
                _examService.Delete(deletedExam);

                List <Question> questions = new List <Question>();
                questions = _questionService.GetAll().Where(x => x.ExamId == id).ToList();

                foreach (var q in questions)
                {
                    _questionService.Delete(q);

                    List <Option> options = new List <Option>();
                    options = _optionsService.GetAll().Where(x => x.QuestionId == q.QuestionId).ToList();

                    foreach (var o in options)
                    {
                        _optionsService.Delete(o);
                    }
                }
            }
            return(RedirectToAction("ExamList"));
        }
Exemple #3
0
        public IActionResult Delete(int id)
        {
            var exam = _examService.GetById(id);

            _examService.Delete(exam);

            return(RedirectToAction("GetExamList"));
        }
        public IActionResult Delete(int id)
        {
            var exam = _service.Get(d => d.Id == id);

            _service.Delete(exam);

            return(Ok());
        }
Exemple #5
0
        public ActionResult Delete(int id)
        {
            if (_examService.Delete(id))
            {
                return(View("Index"));
            }

            return(View("Index"));
        }
        public async Task <IActionResult> Delete(Guid id)
        {
            var result = await _examService.Delete(id);

            if (result.Message != ApiResultMessages.Ok)
            {
                return(BadRequest(result));
            }

            return(Ok(result));
        }
Exemple #7
0
        public IActionResult Delete(int examId)
        {
            var result = _examService.Delete(examId);

            if (result.Success)
            {
                return(Ok(result.Message));
            }

            return(BadRequest(result.Message));
        }
Exemple #8
0
        public async Task<IActionResult> DeleteExam(Guid id)
        {
            var exam = await examService.FindById(id);
            if (exam == null)
            {
                return NotFound();
            }

            await examService.Delete(id);

            return NoContent();
        }
Exemple #9
0
        public async Task DeleteExam(ExamUpdateList exam)
        {
            ValidationErrors = null;
            try
            {
                await _examService.Delete(exam.Id);

                Exams.RowEditOptions.EditRowId = null;
                Exams.RequestRefresh();
            }
            catch (ValidationException ve)
            {
                ValidationErrors = ve.Errors.ToList();
            }
        }
        public IActionResult DeleteExam(int id)
        {
            try
            {
                var result = _ExamService.Delete(id);

                if (result.IsSucceeded)
                {
                    return(Ok(result.Result));
                }
                return(BadRequest(result.HttpGetResponse()));
                //return result.HttpGetResponse();
            }
            catch (Exception e)

            {
                return(BadRequest(e.Message));
            }
        }
        public bool Delete(Guid bankId)
        {
            var  listQuestion   = questionRepository.ListByBankId(bankId);
            var  listQuestionId = listQuestion.Select(x => x.Id).ToList();
            bool deleteQuest    = questionRepository.Delete(listQuestionId);
            bool flag           = true;
            var  listExamId     = examRepository.ListExamIdByBankId(bankId);

            listExamId.ForEach(x =>
            {
                if (!examService.Delete(x))
                {
                    flag = false;
                }
            });

            flag = bankRepository.Delete(bankId) && flag;

            return(flag && deleteQuest);
        }
        public IActionResult ExamDelete(int id)
        {
            Exam            exam      = examService.Get(id);
            List <Question> questions = questionService.GetAll(exam.ID).ToList();

            foreach (Question question in questions)
            {
                List <Option> options = optionService.GetAll(question.ID).ToList();

                foreach (Option option in options)
                {
                    optionService.Delete(option);
                }

                questionService.Delete(question);
            }

            examService.Delete(exam);

            return(RedirectToAction("ExamList"));
        }
        public IActionResult Delete(int id)
        {
            _service.Delete(id);

            return(Ok());
        }
        public async Task <IActionResult> DeleteAsync(int id)
        {
            var result = await _examService.Delete(id);

            return(Ok(result));
        }
Exemple #15
0
 public ActionResult Delete(int id)
 {
     _examService.Delete(id);
     return(RedirectToAction("Index", "Member"));
 }
 public bool Delete(string id)
 {
     return(examService.Delete(id));
 }
Exemple #17
0
 public IActionResult Delete(int examId)
 {
     _examService.Delete(examId);
     return(StatusCode(201));
 }