コード例 #1
0
 /// <summary>
 /// Updates a User record in the database
 /// </summary>
 /// <param name="record">Record to update</param>
 public async Task UpdateUserAsync(UserRecord record)
 {
     await OperationAsync(async ctx =>
     {
         var userInDb = await ctx.FirstOrDefaultAsync <UserRecord>(
             "where [Id] = @0", record.Id);
         if (userInDb == null)
         {
             return;
         }
         userInDb.MergeChangesFrom(record);
         userInDb.LastModifiedUtc = DateTimeOffset.UtcNow;
         await ctx.UpdateAsync(userInDb);
     });
 }
コード例 #2
0
 /// <summary>
 /// Maps the specified UserRecord to a UserDto instance
 /// </summary>
 /// <param name="record">UserRecord to map</param>
 /// <returns>UserDto instance</returns>
 public static UserDto MapUser(UserRecord record)
 {
     return(new UserDto
     {
         Id = record.Id,
         SubscriptionId = record.SubscriptionId,
         UserName = record.UserName,
         Email = record.Email,
         SecurityStamp = record.SecurityStamp,
         PasswordHash = record.PasswordHash,
         LastFailedAuthUtc = record.LastFailedAuthUtc,
         AccessFailedCount = record.AccessFailedCount,
         LockedOut = record.LockedOut,
         OwnerSuspend = record.OwnerSuspend,
         PasswordResetSuspend = record.PasswordResetSuspend,
         CreatedUtc = record.CreatedUtc,
         LastModifiedUtc = record.LastModifiedUtc
     });
 }
コード例 #3
0
 /// <summary>
 /// Inserts a User record into the database
 /// </summary>
 /// <param name="record">Record to insert</param>
 public async Task InsertUserAsync(UserRecord record)
 {
     await OperationAsync(ctx => ctx.InsertAsync(record));
 }