public async Task <IActionResult> PutManufacturerModel(Guid id, ManufacturerModel manufacturerModel) { if (id != manufacturerModel.Id) { return(BadRequest()); } var ma = new ManufacturerModel { Name = manufacturerModel.Name, AmendedOn = DateTime.Now, CreatedOn = manufacturerModel.CreatedOn, Id = manufacturerModel.Id }; _context.Entry(ma).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ManufacturerModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutTruckModel(Guid id, TruckModel truckModel) { if (id != truckModel.Id) { return(BadRequest()); } var truck = new TruckModel { Id = truckModel.Id, ManufacturerId = truckModel.ManufacturerId, Year = truckModel.Year, QuantityInStock = truckModel.QuantityInStock, Model = truckModel.Model, EngineId = truckModel.EngineId, MaximumLoad = truckModel.MaximumLoad, Color = truckModel.Color, CreatedOn = truckModel.CreatedOn, NumberOfWheels = truckModel.NumberOfWheels, AmendedOn = DateTime.UtcNow }; _context.Entry(truck).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TruckModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutMotorbikeModel(Guid id, MotorbikeModel motorbikeModel) { if (id != motorbikeModel.Id) { return(BadRequest()); } var motorbike = new MotorbikeModel { Id = motorbikeModel.Id, ManufacturerId = motorbikeModel.ManufacturerId, Year = motorbikeModel.Year, QuantityInStock = motorbikeModel.QuantityInStock, Model = motorbikeModel.Model, EngineId = motorbikeModel.EngineId, HasWindVisor = motorbikeModel.HasWindVisor, Color = motorbikeModel.Color, CreatedOn = motorbikeModel.CreatedOn, AmendedOn = DateTime.UtcNow }; _context.Entry(motorbike).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MotorbikeModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCarModel(Guid id, CarModel carModel) { if (id != carModel.Id) { return(BadRequest()); } var car = new CarModel { Id = carModel.Id, ManufacturerId = carModel.ManufacturerId, Year = carModel.Year, QuantityInStock = carModel.QuantityInStock, Model = carModel.Model, EngineId = carModel.EngineId, HasRustDamage = carModel.HasRustDamage, Color = carModel.Color, CreatedOn = carModel.CreatedOn, AmendedOn = DateTime.UtcNow }; _context.Entry(car).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CarModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutEngineModel(Guid id, EngineModel engineModel) { if (id != engineModel.Id) { return(BadRequest()); } var engine = new EngineModel { Model = engineModel.Model, ManufacturerId = engineModel.ManufacturerId, Year = engineModel.Year, Size = engineModel.Size, AmendedOn = DateTime.UtcNow, CreatedOn = engineModel.CreatedOn, Id = engineModel.Id, Mileage = engineModel.Mileage }; _context.Entry(engine).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EngineModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }