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); }
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(); }
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); }
public ReportsControllerMethods(Mailer mailer, SiteQueries siteQueries, AdminQueries adminQueries) { _mailer = mailer; _siteQueries = siteQueries; _adminQueries = adminQueries; }
public ReportsController(Mailer mailer, SiteQueries siteQueries, AdminQueries adminQueries) { _mailer = mailer; _methods = new ReportsControllerMethods(mailer, siteQueries, adminQueries); }
public AdminController(AdminQueries _adminQueries, Mailer _mailer, IHttpContextAccessor httpContextAccesssor) { adminQueries = _adminQueries; methods = new AdminControllerMethods(adminQueries, _mailer, httpContextAccesssor); }
public SiteAuth(AdminQueries _dbQueryA, SiteQueries _dbQueryS, DataLimiter dataLimiter) : base(_dbQueryA) { dbQueryS = _dbQueryS; _dataLimiter = dataLimiter; }
public Auth(AdminQueries _dbQueryA) { dbQueryA = _dbQueryA; }
public SiteController(SiteQueries _SiteQueries, AdminQueries _AdminQueries) { methods = new SiteControllerMethods(_SiteQueries, _AdminQueries); }
private int _site_container_size = 0; //may be increased public DataLimiter(AdminQueries dbQuery) { _dbQuery = dbQuery; }
public UserAdmin GetAdmin(Guid id) { return(_context.Admin.AsNoTracking().FirstOrDefault(AdminQueries.GetAdminById(id))); }
public RegistrationValidator(AdminQueries _dbQuery) { dbQuery = _dbQuery; }