public static CarTypeViewModel CreateCarTypeViewModel(CarType carType) { ApplicationDbContext db = new ApplicationDbContext(); CarTypeViewModel ectvm = new CarTypeViewModel(); ectvm.CarTypeData = carType; ectvm.CarEdited = new Car();//Just to prevent it being null //ectvm.CarModels = new SelectList(db.CarModels, "CarModelId", "Description", ectvm.CarTypeData.CarModelId); return ectvm; }
public CarTypeView() { carType = new CarType(); }