Example #1
0
 protected override T GetPropertyFromDB <T>(String propertyName)
 {
     using (var db = new PodcastSqlModel())
     {
         PodcastEpisodeModel dbEpisode = db.Episodes.First(ep => ep.EpisodeId == this.EpisodeId);
         PropertyInfo        property  = dbEpisode.GetType().GetProperties().FirstOrDefault(p => p.Name == propertyName);
         return((T)property.GetValue(dbEpisode));
     }
 }
Example #2
0
 protected override void StorePropertyToDB <T>(String propertyName, T value)
 {
     using (var db = new PodcastSqlModel())
     {
         PodcastEpisodeModel dbEpisode = db.Episodes.First(ep => ep.EpisodeId == this.EpisodeId);
         PropertyInfo        property  = dbEpisode.GetType().GetProperties().FirstOrDefault(p => p.Name == propertyName);
         property.SetValue(dbEpisode, value);
         db.SubmitChanges();
     }
 }