public EditOrderDetailCommandValidator(INorthwindContext context) { _context = context; RuleFor(x => x.OrderId).NotEmpty().WithMessage(ValidationErrorMessages.RequiredMessage); RuleFor(x => x.ProductId).NotEmpty().WithMessage(ValidationErrorMessages.RequiredMessage); RuleFor(x => x.EmployeeId).NotEmpty().WithMessage(ValidationErrorMessages.RequiredMessage); RuleFor(x => x.OrderDate).NotEmpty().WithMessage(ValidationErrorMessages.RequiredMessage); RuleFor(x => x.CustomerId).Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage(ValidationErrorMessages.RequiredMessage) .Length(3, 100).WithMessage(ValidationErrorMessages.LengthError); RuleFor(x => x.ShipAddress).Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage(ValidationErrorMessages.RequiredMessage) .Length(10, 300).WithMessage(ValidationErrorMessages.LengthError); RuleFor(x => x.ShipPostalCode).Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage(ValidationErrorMessages.RequiredMessage) .Matches("[0-9]{5}-[0-9]{4}").WithMessage(ValidationErrorMessages.WrongFormat); RuleFor(x => x.RequiredDate).Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage(ValidationErrorMessages.RequiredMessage) .GreaterThan(x => x.OrderDate).When(x => x.OrderDate.HasValue).WithMessage(ValidationErrorMessages.LesserThan) .LessThan(x => x.ShippedDate).When(x => x.ShippedDate.HasValue).WithMessage(ValidationErrorMessages.LesserThan); RuleFor(x => x.Quantity).Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage(ValidationErrorMessages.RequiredMessage) .MustAsync((q, v, ct) => isQuantityValid(q.OrderId, q.ProductId, v)).WithMessage(ValidationErrorMessages.QuantityNotSufficient); }
public RepositoryBase(INorthwindContext northwindContext) { this.northwindContext = northwindContext; }
protected ReportBase(INorthwindContext dbContext) { NorthwindContext = dbContext; }
public IsQuantityValidQueryHandler(INorthwindContext context) { _context = context; }
public ProductRepository() { _context = new NorthwindContext(); }
public UnitOfWork(NorthwindContext context) { _context = context; }
public GetDropDownListDataQueryhandler(INorthwindContext context) { _context = context; }
public GenericRepository(/*ILogger<GenericRepository<T>> logger, */ INorthwindContext dbContext) { //this.logger = logger; this.dbContext = dbContext; dbSet = dbContext.Set <T>(); }
public void NorthwindTestInitialize() { _context = new NorthwindContext("Northwind"); _repository = new Repository(_context); }
public DeleteProductCommandHandler(INorthwindContext context) { _context = context; }
public NorthwindRepository(INorthwindContext northwindDb) { _northwindDb = northwindDb; }
public UnitOfWork(/*ILoggerFactory loggerFactory, */ INorthwindContext dbContext) { //this.loggerFactory = loggerFactory; //logger = loggerFactory.CreateLogger<UnitOfWork>(); this.dbContext = dbContext; }
public CategoryController(INorthwindContext context) { //Utilizar el contexto doble de prueba this.Context = context; }
public CategoryController() { //Instanciar contexto entoty framwork (Produccion) Context = new NorthWindContext(); }
public SearchOrderDetailsQueryHandler(INorthwindContext context) { _context = context; }
public HomeController(INorthwindContext dbContext, IMailSender mailSender) { _northwindDbContext = dbContext; _mailSender = mailSender; }
public SupplierRepository(INorthwindContext northwindDb) : base(northwindDb) { _northwindDb = northwindDb; }
public GetProductDetailsQueryHandler(INorthwindContext context, IMapper mapper) { _context = context; _mapper = mapper; }
private static Dictionary <DropDownListIdentifier, IQueryable <KeyValue> > _configData(INorthwindContext context) { return(new Dictionary <DropDownListIdentifier, IQueryable <KeyValue> >() { { DropDownListIdentifier.Categories, context.Categories.Select(x => new KeyValue(x.CategoryId, x.CategoryName)) }, { DropDownListIdentifier.Suppliers, context.Suppliers.Select(x => new KeyValue(x.SupplierId, x.CompanyName)) }, { DropDownListIdentifier.Employees, context.Employees.Select(x => new KeyValue(x.EmployeeId, $"{x.FirstName} {x.LastName}")) }, { DropDownListIdentifier.Customers, context.Customers.Select(x => new KeyValue(x.CustomerId, x.CompanyName)) }, { DropDownListIdentifier.Countries, context.Customers.Select(x => new KeyValue(x.Country, x.Country)) }, }); }
public CategoryController() { Context = new NorthwindContext(); }
public UnitOfWork() { _context = new NorthwindContext(); }
public CategoryController(INorthwindContext context) { this.Context = context; }
public ProductRepository(INorthwindContext context) { _context = context; }
public CategoryRepository(INorthwindContext northwindDb) : base(northwindDb) { _northwindDb = northwindDb; }
public SalesReport(INorthwindContext dbContext) : base(dbContext) { }
public EditProductCommandHandler(INorthwindContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public UnitOfWork(IGameStoreContext gameStoreDb, INorthwindContext northwindDb) { _gameStoreDb = gameStoreDb; _northwindDb = northwindDb; }
public GetOrderDetailQueryHandler(INorthwindContext context) { _context = context; }
public IsProductNameUniqueQueryHandler(INorthwindContext context) { _context = context; }
public ProductRepository(INorthwindContext northwindContext) : base(northwindContext) { }
public SearchProductQueryHandler(INorthwindContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public EditOrderDetailCommandHandler(INorthwindContext context) { _context = context; }
public ProductRepository(INorthwindContext northwindDb) : base(northwindDb) { _northwindDb = northwindDb; }
public Repository(INorthwindContext context) { _context = context; }