Esempio n. 1
0
        public static CarViewModel ToViewModel(CarDB dbcar)
        {
            var ViewCar = new CarViewModel()
            {
                CarId       = dbcar.CarId,
                Colour      = dbcar.Colour,
                id          = dbcar.Id,
                Make        = dbcar.Make,
                Model       = dbcar.Model,
                PicturePath = dbcar.PicturePath,
                RegNo       = dbcar.RegNo,
                UserId      = dbcar.UserId
            };

            return(ViewCar);
        }
Esempio n. 2
0
        public static List <CarViewModel> ToViewModel(List <CarDB> cars)
        {
            List <CarViewModel> ViewList = new List <CarViewModel>();

            foreach (var car in cars)
            {
                CarViewModel newCar = new CarViewModel()
                {
                    id          = car.Id,
                    CarId       = car.CarId,
                    UserId      = car.UserId,
                    RegNo       = car.RegNo,
                    Make        = car.Make,
                    Model       = car.Model,
                    Colour      = car.Colour,
                    PicturePath = car.PicturePath
                };

                ViewList.Add(newCar);
            }
            return(ViewList);
        }