public MakerSpaceIdentifierValidator(MODContext context) { _context = context; RuleFor(x => x.MakerSpaceId).MustAsync(async(id, cancellationToken) => { var makerSpace = await _context.MakerSpace.FirstOrDefaultAsync(x => x.Id == id); return(!(makerSpace is null)); }).WithMessage("MakerSpace doesn't exist"); _context = context; }
public RequestFixture() { _options = new DbContextOptionsBuilder <MODContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; DbContext = new MODContext(_options); Fixture = new Fixture(); }
public AddMakerSpaceToolValidator(MODContext context) { _context = context; RuleFor(x => x.MakerSpaceId).SetValidator(new ExistsInDatabase <MakerSpace, Guid>(_context)) .DependentRules(() => { RuleFor(x => new { Id = x.MakerSpaceId, x.Make, x.Model }).MustAsync(async(req, cancellation) => { return(!(await _context.MakerSpace.Include(x => x.Tools) .FirstOrDefaultAsync(x => req.Id == x.Id)) .Tools.Any(x => x.Make == req.Make && x.Model == req.Model)); }).WithMessage(x => $"Tool with make: \"{x.Make}\" and model: \"{x.Model}\" already exists on MakerSpace"); }); }
public RemoveMakerSpaceToolValidator(MODContext context) { _context = context; RuleFor(x => x.MakerSpaceId).MustAsync(async(id, cancellation) => { _makerSpace = await _context.MakerSpace.Include(x => x.Tools).FirstOrDefaultAsync(x => x.Id == id); return(!(_makerSpace is null)); }).WithMessage(x => $"MakerSpace not found by id {x.MakerSpaceId}") .DependentRules(() => { RuleFor(x => x.ToolId).Must(toolId => { var msTool = _makerSpace?.Tools.FirstOrDefault(x => x.Id == toolId); return(!(msTool is null)); }).WithMessage(x => $"Tool does not exists on MakerSpace {x.MakerSpaceId}"); }); }
public AccountRepository(MODContext context) { this.context = context; }
public GetMakerSpaceByIdHandler(MODContext context) { _context = context; }
public GetAllMakerSpacesRequestHandler(MODContext context) { _context = context; }
public GetUserByIdHandler(MODContext context) { _context = context; }
public UserController(IMediator mediator, MODContext context) { _mediator = mediator; _context = context; }
public EventController(MODContext MODContext, IMediator mediator) { _context = MODContext; _mediator = mediator; }
public EditMakerSpaceAddressHandler(MODContext context) { _context = context; }
public EditMakerSpaceContactInfoHandler(MODContext context) { _context = context; }
public UpdateUserHandler(MODContext context) { _context = context; }
public DeleteMakerSpaceHandler(MODContext context) { _context = context; }
public GetAllUsersHandler(MODContext context) { _context = context; }
public SearchForMakerSpaceHandler(MODContext context) { _context = context; }
public AdminRepository(MODContext context) { this.context = context; }
public RegisterMakerSpaceHandler(MODContext context) { _context = context; }
public GetToolsByMakerSpaceIdHandler(MODContext context) { _context = context; }
public AddMakerSpaceToolsHandler(MODContext context) { _context = context; }
public EditMakerSpaceContactInfoValidator(MODContext context) { _context = context; Include(new MakerSpaceIdentifierValidator(_context)); Include(new ContactInfoValidator()); }
public RemoveMakerSpaceToolsHandler(MODContext context) { _context = context; }
public BadgeController(MODContext MODContext) { _context = MODContext; }
public RegisterUserHandler(MODContext context) { _context = context; }
public EditBaseMakerSpaceValidator(MODContext context) { _context = context; Include(new MakerSpaceIdentifierValidator(_context)); Include(new BaseMakerSpaceValidator()); }
public EditBaseMakerSpaceHandler(MODContext context) { _context = context; }
public EditMakerSpaceAddressValidator(MODContext context) { Include(new MakerSpaceIdentifierValidator(context)); Include(new AddressValidator()); }
public RegisterEventHandler(MODContext context) { _context = context; }
public UpdateMakerSpaceHandler(MODContext context) { _context = context; }
public RemoveUserHandler(MODContext context) { _context = context; }