public async Task <IActionResult> PutEvehicles(long id, Evehicles evehicles) { if (id != evehicles.EvehiclesId) { return(BadRequest()); } _context.Entry(evehicles).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EvehiclesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Evehicles> > PostEvehicles(Evehicles evehicles) { _context.Evehicles.Add(evehicles); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (EvehiclesExists(evehicles.EvehiclesId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetEvehicles", new { id = evehicles.EvehiclesId }, evehicles)); }