public CreateImageCommandValidator(ReptoReptoDbContext context) { RuleFor(x => x.Url).NotEmpty().MustAsync(async(request, val, token) => { Uri uriResult; bool result = Uri.TryCreate(val, UriKind.Absolute, out uriResult) && uriResult.Scheme == Uri.UriSchemeHttp; return(result); }).WithMessage("This URL is not correct."); }
public CreateCommentCommandValidator(ReptoReptoDbContext context) { RuleFor(x => x.PostId).NotEmpty().MustAsync(async(request, val, token) => { var postResult = await context.Posts.FirstOrDefaultAsync(x => x.Id.Equals(val)); if (postResult == null) { return(false); } return(true); }).WithMessage("This post does not exist."); RuleFor(x => x.Title).NotEmpty().WithMessage("Title cannot be empty."); RuleFor(x => x.User).NotEmpty().WithMessage("Author cannot be empty."); RuleFor(x => x.Content).NotEmpty().WithMessage("Content cannot be empty."); }
public Handler(ReptoReptoDbContext context) { _context = context; }
public JwtService(ReptoReptoDbContext context, IOptions <JwtSettings> jwt) { _context = context; _jwt = jwt; }
public GetCategoryListQueryHandler(ReptoReptoDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public UpdateCategoryCommandValidator(ReptoReptoDbContext context) { RuleFor(x => x.Title).NotEmpty().WithMessage("Title cannot be empty."); }
public GetImageDetailQueryHandler(ReptoReptoDbContext context) { _context = context; }
public SearchUserCommentsQueryHandler(ReptoReptoDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public GetCategoryDetailQueryHandler(ReptoReptoDbContext context) { _context = context; }