public async Task <IActionResult> PutToolRepoAssociation(int id, ToolRepoAssociation toolRepoAssociation) { if (id != toolRepoAssociation.ID) { return(BadRequest()); } _context.Entry(toolRepoAssociation).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ToolRepoAssociationExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutService([FromRoute] int id, [FromBody] Service service) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != service.ID) { return(BadRequest()); } _context.Entry(service).State = EntityState.Modified; try { await _context.SaveChangesAsync().ConfigureAwait(false); } catch (DbUpdateConcurrencyException) { if (!ServiceExists(id)) { return(NotFound()); } else { throw; } } return(CreatedAtAction("GetService", new { id = service.ID }, service)); }
public async Task <IActionResult> PutRepo([FromRoute] int id, [FromBody] Repository repository) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != repository.ID) { return(BadRequest()); } _context.Entry(repository).State = EntityState.Modified; try { await _context.SaveChangesAsync().ConfigureAwait(false); } catch (DbUpdateConcurrencyException) { if (!RepoExists(id)) { return(NotFound()); } else { throw; } } return(Ok(repository)); }
public async Task <IActionResult> PutCitation(int id, Citation citation) { if (id != citation.ID) { return(BadRequest()); } _context.Entry(citation).State = EntityState.Modified; try { await _context.SaveChangesAsync().ConfigureAwait(false); } catch (DbUpdateConcurrencyException) { if (!CitationExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task<IActionResult> PutTool([FromRoute] int id, [FromBody] Tool DataItem) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != DataItem.ID) { return BadRequest(); } _context.Entry(DataItem).State = EntityState.Modified; try { await _context.SaveChangesAsync().ConfigureAwait(false); } catch (DbUpdateConcurrencyException) { if (!ToolExists(id)) { return NotFound(); } else { throw; } } return NoContent(); }
public async Task <ActionResult <Category> > GetCategory(int id) { var category = await _context.Categories.FindAsync(id); await _context.Entry(category) .Collection(x => x.ToolAssociations) .LoadAsync() .ConfigureAwait(false); await _context.Entry(category) .Collection(x => x.RepoAssociations) .LoadAsync() .ConfigureAwait(false); if (category == null) { return(NotFound()); } return(category); }