public async Task <IActionResult> PutEvehicle(short id, Evehicle evehicle) { if (id != evehicle.EvehicleId) { return(BadRequest()); } _context.Entry(evehicle).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EvehicleExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Evehicle> > PostEvehicle(Evehicle evehicle) { _context.Evehicle.Add(evehicle); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (EvehicleExists(evehicle.EvehicleId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetEvehicle", new { id = evehicle.EvehicleId }, evehicle)); }