public async Task <IActionResult> PutCustomerCompany(int id, CustomerCompany customerCompany) { if (id != customerCompany.Id) { return(BadRequest()); } _context.Entry(customerCompany).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerCompanyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutTrailerType(int id, TrailerType trailerType) { if (id != trailerType.Id) { return(BadRequest()); } _context.Entry(trailerType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TrailerTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutDriversWagons(int id, DriversWagons driversWagons) { if (id != driversWagons.Id) { return(BadRequest()); } _context.Entry(driversWagons).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DriversWagonsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutLoad(int id, Load load) { if (id != load.Id) { return(BadRequest()); } _context.Entry(load).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LoadExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutWagon(int id, Wagon wagon) { if (id != wagon.Id) { return(BadRequest()); } if (wagon.WagonNum != null) { NumValid(wagon); } var trailer = _context.Trailers.Find(wagon.TrailerId); if (trailer == null) { ModelState.AddModelError("TrailerId", "Не вірно вказаний причіп"); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Entry(wagon).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WagonExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutTrailer(int id, Trailer trailer) { if (id != trailer.Id) { return(BadRequest()); } var trailerType = _context.TrailerTypes.Find(trailer.TrailerTypeId); if (trailerType == null) { ModelState.AddModelError("TrailerTypeId", "Не вірно вказаний тип причіпу"); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Entry(trailer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TrailerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }