예제 #1
0
        public async Task <ActionResult <GuidDataResponse> > CreateGuidData(GuidDataRequest request)
        {
            GuidDataRequestValidator.EnsureValid(request);

            var response = await _provider.CreateGuidData(request);

            return(Created($"{UriHelper.GetEncodedUrl(Request)}/{response.Guid}", response));
        }
예제 #2
0
        public async Task <ActionResult <GuidDataResponse> > UpsertGuidData(string guid, GuidDataRequest request)
        {
            GuidValidator.EnsureValid(guid);
            GuidDataRequestValidator.EnsureValid(request);

            var(response, isUpdated) = await _provider.UpsertGuidData(guid, request);

            if (isUpdated)
            {
                return(Ok(response));
            }
            else
            {
                return(Created(UriHelper.GetEncodedUrl(Request), response));
            }
        }