public UpdatePlanetCommandValidator(SolarSystemDbContext context) : base(context) { RuleFor(x => x.Id).NotEmpty(); RuleFor(x => x.Name) .MinimumLength(3) .MaximumLength(50) .NotEmpty(); RuleFor(x => x.ImageUrl) .MinimumLength(10) .MaximumLength(150) .NotEmpty(); RuleFor(x => x.Introduction) .MinimumLength(10) .MaximumLength(150) .NotEmpty(); RuleFor(x => x.Description) .MinimumLength(30) .MaximumLength(3000) .NotEmpty(); RuleFor(x => x.Type) .MinimumLength(5) .MaximumLength(20) .NotEmpty(); RuleFor(x => x).Must(planet => PlanetExists(planet.Name, planet.Id)) .WithMessage("The planet already exists in the database."); }
public AdministrationController(RoleManager <IdentityRole> roleManager, UserManager <IdentityUser> userManager, IHttpContextAccessor httpContextAccessor, SolarSystemDbContext context, SignInManager <IdentityUser> signInManager) { _httpContextAccessor = httpContextAccessor; _roleManager = roleManager; _userManager = userManager; _context = context; _signInManager = signInManager; }
protected SolarSystemDbContext GetContextWithData() { var options = new DbContextOptionsBuilder <SolarSystemDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var context = new SolarSystemDbContext(options); context.Database.EnsureCreated(); SolarSystemInitialiser.Initialise(context); return(context); }
public TeacherController(SolarSystemDbContext context) { _context = context; _solarDAL = new SolarDAL(); }
protected BaseCommandValidator(SolarSystemDbContext context) { _context = context; }
public GetPlanetsQueryHandler(SolarSystemDbContext context) { _context = context; }
public Repository(SolarSystemDbContext dataContext) { this.dataContext = dataContext; DbSet = dataContext.Set <T>(); }
public CreatePlanetCommandHandler(SolarSystemDbContext context) : base(context) { _context = context; }
protected BaseCommandHandler(SolarSystemDbContext context) { _context = context; }
public GetPlanetQueryValidator(SolarSystemDbContext context) : base(context) { RuleFor(v => v.Id).NotEmpty(); }
public DeletePlanetCommandValidator(SolarSystemDbContext context) : base(context) { RuleFor(x => x.Id).NotEmpty(); }
public StudentController(SolarSystemDbContext context, IHttpContextAccessor httpContextAccessor) { _context = context; _solarDal = new SolarDAL(); _httpContextAccessor = httpContextAccessor; }