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;
 }
コード例 #3
0
        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();
 }
コード例 #5
0
 protected BaseCommandValidator(SolarSystemDbContext context)
 {
     _context = context;
 }
 public GetPlanetsQueryHandler(SolarSystemDbContext context)
 {
     _context = context;
 }
コード例 #7
0
 public Repository(SolarSystemDbContext dataContext)
 {
     this.dataContext = dataContext;
     DbSet            = dataContext.Set <T>();
 }
 public CreatePlanetCommandHandler(SolarSystemDbContext context) : base(context)
 {
     _context = context;
 }
コード例 #9
0
 protected BaseCommandHandler(SolarSystemDbContext context)
 {
     _context = context;
 }
コード例 #10
0
 public GetPlanetQueryValidator(SolarSystemDbContext context) : base(context)
 {
     RuleFor(v => v.Id).NotEmpty();
 }
コード例 #11
0
 public DeletePlanetCommandValidator(SolarSystemDbContext context) : base(context)
 {
     RuleFor(x => x.Id).NotEmpty();
 }
コード例 #12
0
 public StudentController(SolarSystemDbContext context, IHttpContextAccessor httpContextAccessor)
 {
     _context             = context;
     _solarDal            = new SolarDAL();
     _httpContextAccessor = httpContextAccessor;
 }