Пример #1
0
 public object AddQuestion(PostQuestion question)
 {
     if (question == null || string.IsNullOrEmpty(question.Author) ||
         string.IsNullOrEmpty(question.Content) || string.IsNullOrEmpty(question.Title))
     {
         return(new ReturnResult <QuestionModel>(-4, "传入参数错误!"));
     }
     return(_QuestionService.AddQuestion(question.ToModel()));
 }
Пример #2
0
        public object SaveAndSubmitQuestion(PostQuestion question)
        {
            if (question == null || string.IsNullOrEmpty(question.Author) ||
                string.IsNullOrEmpty(question.Content) || string.IsNullOrEmpty(question.Title))
            {
                return(new ReturnResult <QuestionModel>(-4, "传入参数错误!"));
            }
            var temp = question.ToModel();

            temp.QuestionState = 1;
            return(_QuestionService.AddQuestion(temp));
        }