public static List <EngineViewModel> ToList(List <Engine> engines) { List <EngineViewModel> engineViewModels = new List <EngineViewModel>(); foreach (Engine engine in engines) { EngineViewModel engineViewModel = new EngineViewModel(engine); engineViewModels.Add(engineViewModel); } return(engineViewModels); }
public MotorcycleViewModel(Motorcycle motorcycle) : base(motorcycle) { Name = motorcycle.Name; Year = motorcycle.Year; SeatHeight = motorcycle.SeatHeight; Weight = motorcycle.Weight; Brand = new BrandViewModel(motorcycle.Brand); BrandID = Brand.ID; Category = new CategoryViewModel(motorcycle.Category); CategoryID = Category.ID; Engine = new EngineViewModel(motorcycle.Engine); EngineID = Engine.ID; }