public static void SeedUsers(IUserDataContext userDataContext, IPhotosDataContext photosDataContext) { if (!userDataContext.GetAllUsersByLastActive().Result.Any()) { System.Console.WriteLine("Seeding users..."); var userData = System.IO.File.ReadAllText("Data/UserSeedData.json"); var users = JsonConvert.DeserializeObject <List <User> >(userData); foreach (var user in users) { byte[] passwordHash, passwordSalt; CreatePasswordHash("password", out passwordHash, out passwordSalt); user.PasswordHash = passwordHash; user.PasswordSalt = passwordSalt; user.Username = user.Username.ToLower(); userDataContext.Add(user); foreach (var photo in user.PhotosFromSeed) { photo.UserId = userDataContext.GetByUsername(user.Username).Result.Id; photosDataContext.Add(photo); } } System.Console.WriteLine("User Seed complete."); } }
public DetailsPageModel(ILogger <DetailsPageModel> logger, INewsRepository newsRepository, ICityUserRepository cityUserRepository, IUserDataContext userDataContext) { this.logger = logger; this.newsRepository = newsRepository; this.cityUserRepository = cityUserRepository; this.userDataContext = userDataContext; }
public ProfilePageModel(IUserDataContext userDataContext, ICityUserRepository cityUserRepository, ILogger <ProfilePageModel> logger) { this.userDataContext = userDataContext; this.cityUserRepository = cityUserRepository; this.logger = logger; }
public DatingRepository( IUserDataContext userDataContext, ILikesDataContext likesDataContext, IPhotosDataContext photosDataContext, IMessagesDataContext messagesDataContext) { _userDataContext = userDataContext; _likesDataContext = likesDataContext; _photosDataContext = photosDataContext; _messagesDataContext = messagesDataContext; }
public ElectricityPageModel(ILogger <ElectricityPageModel> logger, IElectricityRepository electricityRepository, IElectricityMeasurementRepository electricityMeasurementRepository, IUserDataContext userDataContext, IOptions <WebSettings> webSettingsValue) { this.logger = logger; this.electricityRepository = electricityRepository; this.electricityMeasurementRepository = electricityMeasurementRepository; this.userDataContext = userDataContext; webSettings = webSettingsValue.Value; }
public TestDataContext() { Specializations = new TestSpecializationDataContext(_dataSource); Procedures = new TestProcedureDataContext(_dataSource); Patients = new TestPatientDataContext(_dataSource); Observations = new TestObservationDataContext(_dataSource); Medications = new TestMedicationsDataContext(_dataSource); Hospitalizations = new TestHospitalizationDataContext(_dataSource); HealthGroups = new TestHealthGroupDataContext(_dataSource); Examinations = new TestExaminationDataContext(_dataSource); Doctors = new TestDoctorDataContext(_dataSource); Diagnoses = new TestDiagnosesDataContext(_dataSource); Users = new TestUsersDataContext(_dataSource); }
/// <summary> Validates incoming <see cref="CreateUserCommand"/> </summary> public CreateUserCommandValidator(IUserDataContext context) { RuleFor(x => x.UserCreateContract.UserName) .MustAsync(async(prop, val, token) => !await context.Users.AnyAsync(x => x.UserName == val)) .WithMessage(x => $"User with Username: {x.UserCreateContract.UserName} already exists"); RuleFor(x => x.UserCreateContract.Email) .EmailAddress() .WithMessage(x => $"Email: {x.UserCreateContract.Email} is not in correct format") .MustAsync(async(prop, val, token) => { return(!await context.Users.AnyAsync(x => x.Email == val)); }) .WithMessage(x => $"User with Email: {x.UserCreateContract.Email} already exists"); }
public AccountController([FromServices] IObjectifDataContext objCtx, [FromServices] IUserDataContext userCtx, UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IEmailSender emailSender, ISmsSender smsSender, ILoggerFactory loggerFactory) { this.objCtx = objCtx; this.userCtx = userCtx; _userManager = userManager; _signInManager = signInManager; _emailSender = emailSender; _smsSender = smsSender; _logger = loggerFactory.CreateLogger <AccountController>(); }
} //+ public MsSqlDataContext() { _connectionService = new ConnectionService(); Diagnoses = new SqlServerDiagnoses(_connectionService); Procedures = new SqlServerProcedures(_connectionService); Medications = new SqlServerMedications(_connectionService); Specializations = new SqlServerSpecializations(_connectionService); HealthGroups = new SqlServerHealthGroups(_connectionService); Doctors = new SqlServerDoctors(_connectionService); Hospitalizations = new SqlServerHospitalization(_connectionService); Patients = new SqlServerPatients(_connectionService); Observations = new SqlServerObservations(_connectionService, this); Examinations = new SqlServerExaminations(_connectionService, this); Users = new SqlServerUsers(_connectionService); }
public AuthRepository(IUserDataContext userDataContext) { _userDataContext = userDataContext; }
public UserRepository(IUserDataContext <User> context) : base(context, context.Users) { }
public UserRepository(IUserDataContext context, IOptions <AppSettings> appSettings) { _context = context; _appSettings = appSettings.Value; }
public ObjectifController([FromServices] IObjectifDataContext objCtx, [FromServices] IUserDataContext userCtx) { this.objCtx = objCtx; this.userCtx = userCtx; objVm = new ObjectifViewModel(); }
public FinanceController([FromServices] IUserDataContext userCtx, [FromServices] IDepenseDataContext depenceCtx, [FromServices] IChargeDataContext chargeCtx) { this.userCtx = userCtx; this.depenseCtx = depenceCtx; this.chargeCtx = chargeCtx; }
public NotificationController([FromServices] IObjectifDataContext objCtx, [FromServices] IUserDataContext userCtx) { this.objCtx = objCtx; this.userCtx = userCtx; }
public DashBoardController([FromServices] IUserDataContext userCtx, [FromServices] IObjectifDataContext objCtx) { this.userCtx = userCtx; this.objCtx = objCtx; }
public UserRepository(IUserDataContext dataContext, ILogger <UserRepository> logger) { m_dataContext = dataContext; m_logger = logger; }
public UserAbilityRepository(IUserDataContext dataContext) { _dataContext = dataContext; }
public PasswordResetTokenRepository(IUserDataContext dataContext) { _dataContext = dataContext; }
public RoleRepository(IUserDataContext dataContext) { _dataContext = dataContext; }
public UserStore(IUserDataContext <TUser> context) : base((DbContext)context) { }