dev
Last change
on this file since 53bebc0 was 9df3069, checked in by Стојков Марко <mst@…>, 3 years ago |
Edit answer and answer response
|
-
Property mode
set to
100644
|
File size:
868 bytes
|
Line | |
---|
1 | using FinkiChattery.Commands.Questioning.Validators;
|
---|
2 | using FinkiChattery.Commands.Questioning.Validators.Contracts;
|
---|
3 | using FinkiChattery.Common.User;
|
---|
4 | using FinkiChattery.Persistence.UnitOfWork;
|
---|
5 | using FluentValidation;
|
---|
6 |
|
---|
7 | namespace FinkiChattery.Commands.Questioning
|
---|
8 | {
|
---|
9 | public class EditAnswerResponseValidator : AbstractValidator<EditAnswerResponseCommand>
|
---|
10 | {
|
---|
11 | public EditAnswerResponseValidator(IUnitOfWork unitOfWork, ICurrentUser currentUser)
|
---|
12 | {
|
---|
13 | CascadeMode = CascadeMode.Stop;
|
---|
14 |
|
---|
15 | RuleFor(x => x.Text).AnswerResponseTextValidate();
|
---|
16 | RuleFor(x => new AnswerInQuestionWithUidExistsDto(x.QuestionUid, x.AnswerUid)).SetValidator(new AnswerInQuestionWithUidExists(unitOfWork));
|
---|
17 | RuleFor(x => x.AnswerResponseUid).SetValidator(new StudentIsOwnerOfAnswerResponse(unitOfWork, currentUser));
|
---|
18 | }
|
---|
19 | }
|
---|
20 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.