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())); }
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)); }