public async Task <ActionResult <IEnumerable <Model> > > GetSpecification() { var engineTypes = await db.EngineTypes .OrderBy(x => x.Title) .ToListAsync(); var transmissions = await db.Transmissions .OrderBy(x => x.Title) .ToListAsync(); var drivenWheelsTypes = await db.DrivenWheelsTypes .OrderBy(x => x.Title) .ToListAsync(); var colors = await db.Colors .OrderBy(x => x.Title) .ToListAsync(); if (engineTypes == null || transmissions == null || drivenWheelsTypes == null || colors == null) { NotFound(); } var result = new CarSpecifications() { EngineTypes = engineTypes, Transmissions = transmissions, DrivenWheelsTypes = drivenWheelsTypes, Colors = colors }; return(Ok(result)); }
public Car(int cylinders, int horsepower, int torque) { _carSpecifications = new CarSpecifications(cylinders, horsepower, torque); }