public async Task <IActionResult> PutSystem([FromRoute] int id, [FromBody] guardian.service.Models.System system) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != system.Id) { return(BadRequest()); } _context.Entry(system).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SystemExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostSystem([FromBody] guardian.service.Models.System system) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Systems.Add(system); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSystem", new { id = system.Id }, system)); }