dev
Last change
on this file since 95d80e4 was 95d80e4, checked in by Стојков Марко <mst@…>, 3 years ago |
Added unit of work pattern
|
-
Property mode
set to
100644
|
File size:
590 bytes
|
Line | |
---|
1 | using FinkiChattery.Commands.Questioning.Validators;
|
---|
2 | using FinkiChattery.Persistence.UnitOfWork;
|
---|
3 | using FluentValidation;
|
---|
4 |
|
---|
5 | namespace FinkiChattery.Commands.Questioning
|
---|
6 | {
|
---|
7 | public class AskQuestionValidator : AbstractValidator<AskQuestionCommand>
|
---|
8 | {
|
---|
9 | public AskQuestionValidator(IUnitOfWork unitOfWork)
|
---|
10 | {
|
---|
11 | RuleFor(x => x.Title).QuestionTitleValidate();
|
---|
12 | RuleFor(x => x.Text).QuestionTextValidate();
|
---|
13 | RuleFor(x => x.Categories).Cascade(CascadeMode.Stop).ListNotNull().SetValidator(new CategoriesUidsExist(unitOfWork));
|
---|
14 | }
|
---|
15 | }
|
---|
16 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.