コード例 #1
0
        private async Task <ActionResult> GetUser(string id)
        {
            if (!await _representationManager.CheckRepresentationExistsAsync(this, string.Format(UsersName, id)))
            {
                return(new ContentResult
                {
                    StatusCode = 412
                });
            }

            var result = await _usersAction.GetUser(id, GetLocationPattern());

            if (result.IsSucceed())
            {
                await _representationManager.AddOrUpdateRepresentationAsync(this, string.Format(UsersName, result.Id), result.Version, true);
            }

            return(this.GetActionResult(result));
        }
コード例 #2
0
        public async Task <ActionResult> GetUser(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentNullException(nameof(id));
            }

            if (!await _representationManager.CheckRepresentationExistsAsync(this, string.Format(UsersName, id)))
            {
                return(new ContentResult
                {
                    StatusCode = 412
                });
            }

            var result = await _usersAction.GetUser(id, GetLocationPattern());

            if (result.IsSucceed())
            {
                await _representationManager.AddOrUpdateRepresentationAsync(this, string.Format(UsersName, result.Id), result.Version, true);
            }

            return(this.GetActionResult(result));
        }