source: src/FinkiChattery/FinkiChattery.Commands/Questioning/EditAnswerResponse/EditAnswerResponseValidator.cs@ 9df3069

dev
Last change on this file since 9df3069 was 9df3069, checked in by Стојков Марко <mst@…>, 3 years ago

Edit answer and answer response

  • Property mode set to 100644
File size: 868 bytes
Line 
1using FinkiChattery.Commands.Questioning.Validators;
2using FinkiChattery.Commands.Questioning.Validators.Contracts;
3using FinkiChattery.Common.User;
4using FinkiChattery.Persistence.UnitOfWork;
5using FluentValidation;
6
7namespace 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.