Example #1
0
 private int GetExistingMediaTypeId()
 {
     var types = MediaType.GetAll.ToList();
     MediaType found = null;
     DataTypeNoEdit lblField = new DataTypeNoEdit();
     foreach (var d in types)
     {
         var prop = d.PropertyTypes
             .Where(x => x.DataTypeDefinition.DataType.Id == lblField.Id).FirstOrDefault();
         if (prop != null)
         {
             found = d;
             break;
         }
     }
     if (found == null)
     {
         throw new MissingMemberException("No media type was found that contains a label property");
     }
     return found.Id;
 }
Example #2
0
 private Property GetUploadProperty(MediaType mt, Media m)
 {
     DataTypeNoEdit lblField = new DataTypeNoEdit();
     var prop = mt.PropertyTypes
             .Where(x => x.DataTypeDefinition.DataType.Id == lblField.Id).First();
     return m.GenericProperties.Where(x => x.PropertyType.Id == prop.Id).First();
 }