Ejemplo n.º 1
0
        public NewEditorModel(editor editor)
        {
            foreach (var propertyInfo in editor.GetType().GetProperties())
            {
                if (propertyInfo.PropertyType.IsValueType || propertyInfo.PropertyType.Name == "String")
                {
                    propertyInfo.SetValue(this, propertyInfo.GetValue(editor));
                }
            }
            Email              = editor.user.Email;
            Password           = editor.user.Password;
            Deleted            = editor.user.Deleted;
            PermittedCountries = new List <int>();
            PermittedCities    = new List <int>();
            //PermittedRegions = new List<int>();
            foreach (var countryPermission in editor.user.country_permission)
            {
                PermittedCountries.Add(countryPermission.country.Id);
            }

            /*foreach (var regionPermission in editor.user.region_permission)
             * {
             *  PermittedRegions.Add(regionPermission.region.Id);
             * }*/
            foreach (var cityPermission in editor.user.city_permission)
            {
                PermittedCities.Add(cityPermission.city.Id);
            }
        }
Ejemplo n.º 2
0
 public void CopyTo(ref editor editor)
 {
     foreach (var propertyInfo in editor.GetType().GetProperties())
     {
         if (!propertyInfo.Name.Contains("Id") && (propertyInfo.PropertyType.IsValueType || propertyInfo.PropertyType.Name == "String"))
         {
             propertyInfo.SetValue(editor, propertyInfo.GetValue(this));
         }
     }
 }