public async Task <IActionResult> PutRoute(int id, Route route) { if (id != route.RouteID) { return(BadRequest()); } _context.Entry(route).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RouteExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutJourney(int id, Journey journey) { if (id != journey.JourneyID) { return(BadRequest()); } _context.Entry(journey).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JourneyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCities([FromRoute] int id, [FromBody] Cities cities) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != cities.ID) { return(BadRequest()); } _context.Entry(cities).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CitiesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutBusModel(int id, BusModel busModel) { if (id != busModel.BusModelID) { return(BadRequest()); } _context.Entry(busModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BusModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutClient(int id, Client client) { if (id != client.ClientID) { return(BadRequest()); } _context.Entry(client).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public OperationResult Update(Role item) { try { _busStationContext.Entry(item).State = EntityState.Modified; return(new OperationResult { Successed = true }); } catch (Exception e) { return(new OperationResult { Successed = false, Message = e.Message }); } }