public CreateQuestionCMD(CreateQuestionCMD question) { Title = question.Title; QuestionText = question.QuestionText; Autor = question.Autor; Tags = question.Tags; ProfanityCheck = question.ProfanityCheck; // Votes = new List<VoteEnum>(); }
private static string IsQuestionValid(CreateQuestionCMD question) { if (question.QuestionText.Length > 10000) { return("Question too long!"); } if (question.Tags.Length == 0 || question.Tags.Length > 3) { return("Invalid number of tags"); } return("Valid"); }
public static Result <UnvalidatedQuestion> Create(CreateQuestionCMD question) { string msg; if ((msg = IsQuestionValid(question)).Equals("Valid")) { return(new UnvalidatedQuestion(question)); } else { return(new Result <UnvalidatedQuestion>(new InvalidQuestionException(msg))); } }
public UnvalidatedQuestion(CreateQuestionCMD question) { Question = question; }