public GenericService(ITodoContext context, IMapper mapper) { _context = context; _repository = _context.Set <TEntity>(); _mapper = mapper; }
public static void ExistingUser <TRequest>( this IRuleBuilder <TRequest, string> ruleBuilder, ITodoContext context) { ruleBuilder .NotEmpty() .SetValidator(new ExistingUserValidator(context)); }
public TodoService(ITodoContext context, ILogger <TodoService> logger) { _context = context; _logger = logger; _context.EnsureCreated(); if (_context.Count() == 0) { _logger.LogInformation("Adding default item"); _context.Add(new TodoItem { Name = "Item1" }); } }
public TodoServiceTest() { context = Mock.Of <ITodoContext>(); mockContext = Mock.Get(context); logger = Mock.Of <ILogger <TodoService> >(); items = new List <TodoItem>(new[] { new TodoItem { Id = 1, Name = "1", IsComplete = true }, new TodoItem { Id = 2, Name = "2", IsComplete = false } } ); mockContext.Setup(s => s.GetAll()).Returns(items); mockContext.Setup(s => s.Count()).Returns(2); }
public TodoManager(ITodoContext context) { _context = context as TodoContext; if (_context.TodoItems.Any()) { return; } _context.TodoItems.Add(new TodoItem { Name = "Item1" }); _context.TodoItems.Add(new TodoItem { Name = "Item2" }); _context.TodoItems.Add(new TodoItem { Name = "Item3" }); _context.TodoItems.Add(new TodoItem { Name = "Item4" }); _context.TodoItems.Add(new TodoItem { Name = "Item5" }); _context.TodoItems.Add(new TodoItem { Name = "Item6" }); _context.TodoItems.Add(new TodoItem { Name = "Item7" }); _context.TodoItems.Add(new TodoItem { Name = "Item8" }); _context.SaveChanges(); }
public UpdateTodoItemCommandHandler(ITodoContext context) { _context = context; }
public TodoService(ITodoContext context, IMapper mapper) : base(context, mapper) { }
public Validator(ITodoContext context) { RuleFor(model => model.Username).ExistingUser(context); RuleFor(model => model.Id).ExistingTodo(context); }
public GetTodoItemsByListIdQueryHandler(ITodoContext context) { _context = context; }
public TodoController(ITodoContext context) { _context = context; }
public ExistingUserValidator(ITodoContext context) { RuleFor(model => model) .MustAsync(async(model, token) => await context.UserExists(model)) .WithMessage(model => $"User: {model} is not found"); }
public Handler(ITodoContext context, IMapping mapper) : base(context, mapper) { }
public UserRepository(ITodoContext todoContext) { _todoContext = todoContext; }
public GetAllTodoListsQueryHandler(ITodoContext context) { _context = context; _repository = _context.Set <Entities.TodoList>(); }
public TodoRepository(ITodoContext context, ILogger <TodoRepository> logger) : base(context) { _logger = logger; }
public BaseService(ITodoContext dbContext) { this.dbContext = dbContext; }
public TodoController(ITodoContext todoContext) { _todoContext = todoContext; }
public BaseRepository(ITodoContext context) { _context = context; }
public UserUpdatedMessageHandler(ITodoContext context) { _context = context; }
public ScheduleRepository(ITodoContext todoContext) { _todoContext = todoContext; }
public GetTodoListByIdQueryHandler(ITodoContext context) { _context = context; }
public Seeder(ITodoContext context) { this.context = context; }
public CreateTodoListCommandHandler(ITodoContext context) { _context = context; }
protected TodoServiceHandler(ITodoContext context, IMapping mapper) { Context = context; Mapper = mapper; }
public UserSignupedMessageHandler(ITodoContext context) { _context = context; }
public ExistingTodoValidator(ITodoContext context) { RuleFor(model => model) .MustAsync(async(model, token) => await context.Todos.AnyAsync(todo => todo.Id == model)) .WithMessage(model => $"Todo with id: {model} is not present"); }
public TodoRepository(ITodoContext context) { _context = context; }
public TodoPointService(ITodoContext dbContext) : base(dbContext) { }
public DatabaseInitializer(ITodoContext todoContext, ISeeder seeder) { this.todoContext = todoContext; this.seeder = seeder; }
public Validator(ITodoContext context) { RuleFor(model => model.Title).NotEmpty(); RuleFor(model => model.Username).ExistingUser(context); }