public static MakeModel CreateModel(MakeDTO dto)
        {
            MakeModel newModel = new MakeModel()
            {
                id   = dto.id,
                name = dto.name
            };

            return(newModel);
        }
        //public virtual IEnumerable<DamageHistoryDTO> damageHistory { get; set; }

        public static VehicleModel CreateModel(VehicleDTO dto)
        {
            VehicleModel newModel = new VehicleModel()
            {
                licenceNum = dto.licenseNum,
                model      = dto.model,
                make       = MakeModel.CreateModel(dto.make),
                state      = dto.state,
                colour     = dto.colour,
                active     = dto.active
            };

            return(newModel);
        }
Esempio n. 3
0
        public static VehicleDetailModel CreateModel(VehicleDTO dto, IEnumerable <DamageHistoryDTO> dmgHistory, IEnumerable <ClockHistoryDTO> clkHistory)
        {
            VehicleDetailModel newModel = new VehicleDetailModel()
            {
                licenceNum    = dto.licenseNum,
                model         = dto.model,
                make          = MakeModel.CreateModel(dto.make),
                state         = dto.state,
                colour        = dto.colour,
                active        = dto.active,
                damageHistory = DamageHistoryModel.CreateModelNumerable(dmgHistory).OrderByDescending(x => x.time),
                clockHistory  = ClockHistoryModel.CreateModelNumerable(clkHistory).OrderByDescending(x => x.time)
            };

            return(newModel);
        }