Example #1
0
        public async Task <ActionResult> UpdateResourceSet([FromBody] PutResourceSet putResourceSet)
        {
            if (putResourceSet == null)
            {
                throw new ArgumentNullException(nameof(putResourceSet));
            }

            var parameter         = putResourceSet.ToParameter();
            var resourceSetExists = await _resourceSetActions.UpdateResourceSet(parameter);

            if (!resourceSetExists)
            {
                return(GetNotFoundResourceSet());
            }

            var response = new UpdateResourceSetResponse
            {
                Id = putResourceSet.Id
            };

            await _representationManager.AddOrUpdateRepresentationAsync(this, CachingStoreNames.GetResourceStoreName + putResourceSet.Id, false);

            return(new ObjectResult(response)
            {
                StatusCode = (int)HttpStatusCode.OK
            });
        }
        public async Task <ActionResult> UpdateResourceSet([FromBody] PutResourceSet putResourceSet)
        {
            if (putResourceSet == null)
            {
                return(BuildError(ErrorCodes.InvalidRequestCode, "no parameter in body request", HttpStatusCode.BadRequest));
            }

            var parameter         = putResourceSet.ToParameter();
            var resourceSetExists = await _resourceSetActions.UpdateResourceSet(parameter);

            if (!resourceSetExists)
            {
                return(GetNotFoundResourceSet());
            }

            var response = new UpdateResourceSetResponse
            {
                Id = putResourceSet.Id
            };

            await _representationManager.AddOrUpdateRepresentationAsync(this, Constants.CachingStoreNames.GetResourceStoreName + putResourceSet.Id, false);

            return(new ObjectResult(response)
            {
                StatusCode = (int)HttpStatusCode.OK
            });
        }