Пример #1
0
        public static ICreateIntrebareResult CreateNewQuestion(CreateIntrebareCmd createQuestion)
        {
            if (string.IsNullOrWhiteSpace(createQuestion.Descriere))
            {
                var errors = new List <string>()
                {
                    "Nu ati adaugat descriere corecta"
                };
                return(new IntrebareValidationFailed(errors));
            }

            if (string.IsNullOrEmpty(createQuestion.Titlu))
            {
                return(new IntrebareaNuEPostata("Adaugati titlu!"));
            }
            if (string.IsNullOrEmpty(createQuestion.Tag))
            {
                return(new IntrebareaNuEPostata("Adaugati tag!"));
            }

            var questionId = Guid.NewGuid();
            var result     = new IntrebarePostata(intrebareId, createQuestion.Descriere);

            return(result);
        }
Пример #2
0
 private static ICreateIntrebareResult ProcessQuetionPosted(IntrebarePostata new_question)
 {
     Console.WriteLine($"IntrebareId {new_question.IntrebareId}");
     Console.WriteLine($"Descriere {new_question.Descriere}");
     Console.WriteLine($"Tag {new_question.Tag}");
     return(new_question);
 }