Exemple #1
0
        public async Task <ConcurrentObject> TryUpdateRepresentationAsync(string representationId, string etag)
        {
            if (string.IsNullOrWhiteSpace(representationId))
            {
                throw new ArgumentNullException(nameof(representationId));
            }

            if (string.IsNullOrWhiteSpace(etag))
            {
                throw new ArgumentNullException(nameof(etag));
            }

            var concurrentObject = new ConcurrentObject
            {
                Etag     = "\"" + etag + "\"",
                DateTime = DateTime.UtcNow
            };
            await _storage.SetAsync(representationId, concurrentObject).ConfigureAwait(false);

            return(concurrentObject);
        }
 private void SetHeaders(Controller controller, ConcurrentObject concurrentObject)
 {
     controller.SetEtag(concurrentObject.Etag);
     controller.SetLastModifiedDate(concurrentObject.DateTime.ToUniversalTime().ToString("R"));
 }