public void EditQuestion(QuestionViewModel editData)
        {
            var       config       = new MapperConfiguration(cfg => { cfg.CreateMap <QuestionViewModel, Questions>(); cfg.IgnoreUnmapped(); });
            IMapper   mapper       = config.CreateMapper();
            Questions editQuestion = mapper.Map <QuestionViewModel, Questions>(editData);

            questionRepository.EditQuestion(editQuestion);
        }
Пример #2
0
 public void EditQuestion(QuestionViewModel viewModel)
 {
     try
     {
         questionRepository.EditQuestion(map.ViewModelToEntity(viewModel));
     }
     catch (Exception exception)
     {
         log.Error(exception);
     }
 }
Пример #3
0
        public void EditQuestion(QuestionModel question)
        {
            _questionRepository.EditQuestion(question);
            List <string> originalTags = _questionRepository.GetQuestionTags(question.Id);
            List <string> newTags      = question.Tags;

            List <string> addTags     = newTags.Except(originalTags).ToList();
            List <Guid>   addedTagIds = _tagRepository.GetTags(addTags).Select(x => x.Id).ToList();

            _questionRepository.AddQuestionTags(addedTagIds, question.Id);

            List <string> removeTags = originalTags.Except(newTags).ToList();
            List <Guid>   removeIds  = _tagRepository.GetTags(removeTags).Select(x => x.Id).ToList();

            _questionRepository.RemoveQuestionTags(removeIds, question.Id);
        }
Пример #4
0
 public static void EditQuestion(int questionID, string subjectNew, string contentNew, Category category, string urgency)
 {
     questionRepo.EditQuestion(questionID, subjectNew, contentNew, category, urgency);
 }