Exemple #1
0
        public void Remove(Guid id)
        {
            var entity = _context.Admin.Find(AdminQueries.GetAdminById(id));

            _context.Admin.Remove(entity);
            _context.SaveChanges();
        }
 public SiteControllerMethods(SiteQueries _dbQuery, AdminQueries _AdbQuery)
 {
     dbQuery       = _dbQuery;
     _dataLimiter  = new DataLimiter(_AdbQuery);
     authenticator = new SiteAuth(_AdbQuery, _dbQuery, _dataLimiter);
     validator     = new SiteCreationValidator(dbQuery);
 }
Exemple #3
0
        public void Can_update_admin()
        {
            var admin = SecurityTestHelper.CreateAdmin();

            var firstName   = TestDataGenerator.GetRandomString();
            var lastName    = TestDataGenerator.GetRandomString();
            var status      = true;
            var language    = TestDataGenerator.GetRandomString();
            var description = TestDataGenerator.GetRandomString();

            admin.FirstName   = firstName;
            admin.LastName    = lastName;
            admin.IsActive    = status;
            admin.Language    = language;
            admin.Description = description;

            var adminData = Mapper.DynamicMap <EditAdminData>(admin);

            adminData.AllowedBrands     = admin.AllowedBrands.Select(b => b.Id).ToList();
            adminData.AssignedLicensees = admin.Licensees.Select(l => l.Id).ToList();
            adminData.Password          = TestDataGenerator.GetRandomString();

            AdminCommands.UpdateAdmin(adminData);

            admin = AdminQueries.GetAdminById(admin.Id);

            Assert.True(admin.FirstName == firstName);
            Assert.True(admin.LastName == lastName);
            Assert.True(admin.IsActive == status);
            Assert.True(admin.Language == language);
            Assert.True(admin.Description == description);
        }
 public AdminControllerMethods(AdminQueries _dbQuery, Mailer _mailer, IHttpContextAccessor httpContextAccesssor)
 {
     _httpContextAccesssor = httpContextAccesssor;
     _currentDomain        = _httpContextAccesssor.HttpContext.Request.Host.Value;
     dbQuery       = _dbQuery;
     mailer        = _mailer;
     authenticator = new Auth(_dbQuery);
     validator     = new RegistrationValidator(_dbQuery);
     _tGen         = new TokenGenerator();
 }
Exemple #5
0
        public void Can_activate()
        {
            // *** Arrange ***
            var admin = SecurityTestHelper.CreateAdmin();

            // *** Act ***
            AdminCommands.Activate(new ActivateUserData(admin.Id, string.Empty));

            // *** Assert ***
            var activatedAdmin = AdminQueries.GetAdminById(admin.Id);

            Assert.IsNotNull(activatedAdmin);
            Assert.True(activatedAdmin.IsActive == true);
        }
Exemple #6
0
 public ReportsControllerMethods(Mailer mailer, SiteQueries siteQueries, AdminQueries adminQueries)
 {
     _mailer       = mailer;
     _siteQueries  = siteQueries;
     _adminQueries = adminQueries;
 }
Exemple #7
0
 public ReportsController(Mailer mailer, SiteQueries siteQueries, AdminQueries adminQueries)
 {
     _mailer  = mailer;
     _methods = new ReportsControllerMethods(mailer, siteQueries, adminQueries);
 }
Exemple #8
0
 public AdminController(AdminQueries _adminQueries, Mailer _mailer, IHttpContextAccessor httpContextAccesssor)
 {
     adminQueries = _adminQueries;
     methods      = new AdminControllerMethods(adminQueries, _mailer, httpContextAccesssor);
 }
Exemple #9
0
 public SiteAuth(AdminQueries _dbQueryA, SiteQueries _dbQueryS, DataLimiter dataLimiter) : base(_dbQueryA)
 {
     dbQueryS     = _dbQueryS;
     _dataLimiter = dataLimiter;
 }
Exemple #10
0
 public Auth(AdminQueries _dbQueryA)
 {
     dbQueryA = _dbQueryA;
 }
Exemple #11
0
 public SiteController(SiteQueries _SiteQueries, AdminQueries _AdminQueries)
 {
     methods = new SiteControllerMethods(_SiteQueries, _AdminQueries);
 }
Exemple #12
0
 private int _site_container_size = 0; //may be increased
 public DataLimiter(AdminQueries dbQuery)
 {
     _dbQuery = dbQuery;
 }
Exemple #13
0
 public UserAdmin GetAdmin(Guid id)
 {
     return(_context.Admin.AsNoTracking().FirstOrDefault(AdminQueries.GetAdminById(id)));
 }
Exemple #14
0
 public RegistrationValidator(AdminQueries _dbQuery)
 {
     dbQuery = _dbQuery;
 }