Created
February 10, 2016 21:02
-
-
Save StevenTCramer/c7dc36a1bcb683835619 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Command : IRequest | |
{ | |
private MyDbContext MyDbContext { get; } | |
public Command(MyDbContext aMyDbContext) | |
{ | |
MyDbContext = aMyDbContext; | |
} | |
public int ProjectId { get; set; } | |
internal Project Project | |
{ | |
get | |
{ | |
return MyDbContext.Projects.Find(ProjectId); | |
} | |
} | |
} | |
public class CommandValidator : AbstractValidator<Command> | |
{ | |
public CommandValidator() | |
{ | |
RuleFor(aCommand => aCommand.ProjectId).NotNull(); | |
RuleFor(aCommand => aCommand.Project).NotNull().WithMessage("Project with Id does not exsit etc...."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment