Ejemplo n.º 1
0
 public IQueryable <MediaImageUserViewModel> GetLast10AddedTitles()
 {
     try
     {
         List <MediaImageUserViewModel> lastAddedList = new List <MediaImageUserViewModel>();
         AWSImageService images = new AWSImageService();
         var             media  = AllMediaDaoEF.Instance.GetLast10AddedTitles();
         Image           image  = null;
         foreach (var med in media)
         {
             if (med.GetType() == typeof(Movie) || med.GetType() == typeof(TV_Show))
             {
                 image = images.GetImagesForVideo((Video)med)[AWSImageService.MEDIUMIMAGE];
             }
             else if (med.GetType() == typeof(Book))
             {
                 image = images.GetImagesForBook((Book)med)[AWSImageService.MEDIUMIMAGE];
             }
             if (image != null)
             {
                 MediaImageUserViewModel recommended = new MediaImageUserViewModel(med, image, null);
                 lastAddedList.Add(recommended);
             }
         }
         return(lastAddedList.AsQueryable <MediaImageUserViewModel>());
     }
     catch (Exception)
     {
         return(new List <MediaImageUserViewModel>().AsQueryable <MediaImageUserViewModel>());
     }
 }
Ejemplo n.º 2
0
 public IQueryable <MediaImageUserViewModel> GetRecommendedMedia(string username)
 {
     try
     {
         List <MediaImageUserViewModel> recommendedList = new List <MediaImageUserViewModel>();
         AWSImageService images = new AWSImageService();
         var             media  = UserMediaDaoEF.Instance.GetRecommendedMedia(username);
         var             user   = MembershipService.Instance.GetCurrentUser(username);
         Image           image  = null;
         foreach (var med in media)
         {
             if (med.GetType() == typeof(Movie) || med.GetType() == typeof(TV_Show))
             {
                 image = images.GetImagesForVideo((Video)med)[AWSImageService.MEDIUMIMAGE];
             }
             else if (med.GetType() == typeof(Book))
             {
                 image = images.GetImagesForBook((Book)med)[AWSImageService.MEDIUMIMAGE];
             }
             if (image != null)
             {
                 MediaImageUserViewModel recommended = new MediaImageUserViewModel(med, image, user);
                 recommendedList.Add(recommended);
             }
         }
         return(recommendedList.AsQueryable <MediaImageUserViewModel>());
     }
     catch (Exception)
     {
         return(new List <MediaImageUserViewModel>().AsQueryable <MediaImageUserViewModel>());
     }
 }