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")); } }
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)); }
public IActionResult GetByTeam(string key) { _logger.Log($"key:{key}"); var releases = ReleaseRepo.FindByTeam(key); if (releases == null) { _logger.Log($"GetById: could not find Team {key}"); return(HttpNotFound()); } return(new ObjectResult(releases)); }
public IActionResult Create([FromBody] Release newRelease) { _logger.Log($"release"); if (newRelease == null) { return(HttpBadRequest("couldn't serialise value")); } _logger.Log($"adding release with key: {newRelease.Key}"); if (ReleaseRepo.Add(newRelease)) { return(CreatedAtRoute("GetRelease", new { controller = "Release", key = newRelease.Key }, newRelease)); } else { return(HttpBadRequest("unable to save release")); } }
public IActionResult Delete(string key) { _logger.Log($"key:{key}"); ReleaseRepo.Remove(key); return(new NoContentResult()); }
public IActionResult Get() { _logger.Log($"Get releases"); return(new ObjectResult(ReleaseRepo.GetAll())); }