/// <summary> /// Updates the user in the database /// </summary> /// <param name="user">User record</param> public async Task UpdateUserAsync(UserRecord user) { await OperationAsync(async ctx => { var userInDb = await ctx.FirstOrDefaultAsync <UserRecord>( "where [Id] = @0", user.Id); if (userInDb == null) { return; } userInDb.MergeChangesFrom(user); userInDb.LastModified = DateTime.UtcNow; await ctx.UpdateAsync(userInDb); }); }
/// <summary> /// Inserts a new user into the database /// </summary> /// <param name="user">User record</param> public async Task InsertUserAsync(UserRecord user) { await OperationAsync(ctx => ctx.InsertAsync(user)); }