コード例 #1
0
        /// <inheritdoc />
        public async Task <IdentityResult> UpdateAsync(LondonTravelUser user, CancellationToken cancellationToken)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            if (user.CreatedAt == DateTime.MinValue)
            {
                user.CreatedAt = DateTimeOffset.FromUnixTimeSeconds(user.Timestamp).UtcDateTime;
            }

            LondonTravelUser updated = await _client.ReplaceAsync(user.Id, user, user.ETag);

            if (updated != null)
            {
                user.ETag = updated.ETag;
                return(IdentityResult.Success);
            }
            else
            {
                return(ResultForError("Conflict", "The user could not be updated as the ETag value is out-of-date."));
            }
        }