public RegiAuthUser(RegiUser user) { Id = user.Id; Email = user.Email; PasswordHash = user.PasswordHash; EmailConfirmed = user.EmailConfirmed; CustomFields = user.CustomFields; }
public RegiDbUser(RegiUser model) { if (model == null) { throw new ArgumentException(nameof(model)); } Id = model.Id; Email = model.Email; PasswordHash = model.PasswordHash; EmailConfirmed = model.EmailConfirmed; }
public SingleRegiUserResponse(RegiUser user) { if (user == null) { return; } Id = user.Id; Email = user.Email; EmailConfirmed = user.EmailConfirmed; CustomFields = user.CustomFields.ToDictionary(cf => cf.Name, cf => cf.Value); }
public async Task AddFieldValueForUser(RegiUser user, CustomUserValue value) { try { using (var connection = await GetConnectionAsync()) { var model = new DbCustomUserValueIn(user, value); await connection.ExecuteAsync(RegistrarQueries.CustomUserValueInsert, model); } } catch (Exception) { throw new Exception("Could not insert custom user value"); } }
public async Task DeleteValuesForUser(RegiUser user) { try { using (var connection = await GetConnectionAsync()) { await connection.ExecuteAsync(RegistrarQueries.CustomUserValueDeleteAllForUser, new { UserId = user.Id }); } } catch (Exception) { throw new Exception("Could not delete custom user values"); } }
public async Task UpdateUser(RegiUser user) { try { using (var connection = await GetConnectionAsync()) { await connection.ExecuteAsync(RegistrarQueries.UserUpdate, user); } } catch (Exception e) { if (e is RecordNotFoundException) { throw; } throw new Exception("Could not update Regi User"); } }
public async Task <RegiUser> CreateUser(RegiUser user) { try { var dbModel = new RegiDbUser(user); using (var connection = await GetConnectionAsync()) { await connection.ExecuteAsync(RegistrarQueries.UserCreate, dbModel); return(user); } } catch (Exception e) { if (e is RecordNotFoundException) { throw; } throw new Exception("Could not get create Regi User"); } }
public DbCustomUserValueIn(RegiUser user, CustomUserValue value) { UserId = user.Id; CustomFieldId = value.FieldId; Value = value.Value; }