コード例 #1
0
        public IActionResult Put(string key, [FromBody] Release updateRelease)
        {
            _logger.Log($"key:{updateRelease.Key}");

            if (updateRelease == null || updateRelease.Key.ToString() != key)
            {
                return(HttpBadRequest());
            }

            var release = ReleaseRepo.FindByKey(key);

            if (release == null)
            {
                return(HttpNotFound());
            }

            if (ReleaseRepo.Update(updateRelease))
            {
                return(new NoContentResult());
            }
            else
            {
                return(HttpBadRequest("unable to save release"));
            }
        }
コード例 #2
0
        public IActionResult GetByKey(string key)
        {
            _logger.Log($"key:{key}");
            var item = ReleaseRepo.FindByKey(key);

            if (item == null)
            {
                _logger.Log($"GetById: could not find release {key}");
                return(HttpNotFound());
            }
            return(new ObjectResult(item));
        }