public IActionResult EditQuestion(AddAndEditQuestionAndAnswerAdminVm model) { _catAndQueService.EditQuestion(model); int iqOfUpdatingQuestion = model.Id; return(new RedirectResult(Url.Action("DetailsOfQuestion", new { Id = iqOfUpdatingQuestion }))); }
public int AddQuestion(AddAndEditQuestionAndAnswerAdminVm questionVm) { var question = _mapper.Map <Question>(questionVm); var id = _categoryAndQuestionForAdminRepo.AddQuestion(question); _categoryAndQuestionForAdminRepo.AfterAcceptNewQuestionRemoveItsCategoryFromUsedCategoriesToAllUser(question.CategoryId); return(id); }
public void EditQuestion(AddAndEditQuestionAndAnswerAdminVm questionVm) { var question = _mapper.Map <Question>(questionVm); var answersToUpdate = question.Answers; var listOfAnswers = answersToUpdate.ToList(); _categoryAndQuestionForAdminRepo.UpdateQuestion(question); _categoryAndQuestionForAdminRepo.UpdateAnswers(listOfAnswers); }
public IActionResult AddQuestion() { var model = new AddAndEditQuestionAndAnswerAdminVm() { Categories = _catAndQueService.GetCategoriesForAdmin() }; return(View(model)); }
public IActionResult AddQuestion(AddAndEditQuestionAndAnswerAdminVm model) { int id = _catAndQueService.AddQuestion(model); return(new RedirectResult(Url.Action("ShowNewQuestionAdmin", new { Id = id }))); }