public async Task <IActionResult> PutCar(int id, Car car) { if (id != car.CarId) { return(BadRequest()); } _context.Entry(car).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CarExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <LogEntry> > DeleteLogEntry(int id) { LogEntry logEntry = await _context.LogEntry.FindAsync(id); if (logEntry == null) { return(NotFound()); } _context.LogEntry.Remove(logEntry); await _context.SaveChangesAsync(); return(logEntry); }
public async Task <ActionResult <Session> > DeleteSession(int id) { Session session = await _context.Session.FindAsync(id); if (session == null) { return(NotFound()); } _context.Session.Remove(session); await _context.SaveChangesAsync(); return(session); }
public async Task <IActionResult> PutConfig(Configuration config) { _context.Entry(config).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(NoContent()); }
public async Task <IActionResult> PutPerson(int id, Person person) { if (id != person.PersonId) { return(BadRequest()); } _context.Entry(person).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }