public async Task <ActionResult <CommuteLeg> > PostCommuteLeg(CommuteLeg commuteLeg) { _context.CommuteLeg.Add(commuteLeg); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCommuteLeg", new { id = commuteLeg.Id }, commuteLeg)); }
public async Task <IActionResult> PutCommuteLeg(int id, CommuteLeg commuteLeg) { if (id != commuteLeg.Id) { return(BadRequest()); } _context.Entry(commuteLeg).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommuteLegExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }