public async Task <IActionResult> PutRunBy(int id, RunBy runBy) { if (id != runBy.AdminId) { return(BadRequest()); } _context.Entry(runBy).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RunByExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <RunBy> > PostRunBy(RunBy runBy) { _context.RunBy.Add(runBy); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (RunByExists(runBy.AdminId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetRunBy", new { id = runBy.AdminId }, runBy)); }