static void Main(string[] args) { var cmd = new PostNewQuestionCmd("Opening Simulink Models created in newer versions of Matlab", "How can i open a Simulink model created in newer version of Matlab? I mention that the model is created in Matlab 2019a and i have Matlab 2015a.", "Simulink, Matlab, Version"); var result = PostNewQuestion(cmd); result.Match( ProcessQuestionPosted, ProcessQuestionNotPosted, ProcessInvalidQuestion ); Console.ReadLine(); }
public static IPostNewQuestionResult PostNewQuestion(PostNewQuestionCmd postNewQuestionCommand) { if (string.IsNullOrWhiteSpace(postNewQuestionCommand.Title)) { return(new QuestionNotPosted("Please insert a title!")); } if (string.IsNullOrWhiteSpace(postNewQuestionCommand.Body)) { var errors = new List <string>() { "Invalid description of question!" }; return(new QuestionValidationFailed(errors)); } var questionId = Guid.NewGuid(); var result = new QuestionPosted(questionId, postNewQuestionCommand.Title, postNewQuestionCommand.Tags, postNewQuestionCommand.Body); return(result); }