Exemple #1
0
        public Data.Entity.Vehicle Convert(VehicleParam param, Data.Entity.Vehicle oldentity)
        {
            Data.Entity.Vehicle entity = null;

            if (oldentity != null)
            {
                entity = oldentity;
            }
            else
            {
                entity = new Data.Entity.Vehicle
                {
                    Code        = param.Code,
                    Id          = param.Id,
                    Description = param.Description,
                    Name        = param.Name
                };
            }

            entity.Owner            = CustomerDao.Find(param.OwnerId);
            entity.Mileage          = param.Mileage;
            entity.DateOfProduction = param.DateOfProduction;
            entity.VehicleStatus    = VehicleStatusDao.Find(param.VehicleStatusId);

            return(entity);
        }