Пример #1
0
        public ActionResult <IEnumerable <VideoDetailsVM> > GetLatestVideosForTalent(int id)
        {
            try
            {
                Talent talent = TalentService.GetActiveByID(id);
                if (talent == null)
                {
                    throw new Exception("Талант не найден");
                }

                List <VideoRequest> videos = VideoRequestService.GetPublicByTalent(talent, 0)
                                             .ToList();

                List <VideoDetailsVM> videosVM = new List <VideoDetailsVM>();
                foreach (var item in videos)
                {
                    videosVM.Add(new VideoDetailsVM(item));
                }

                return(videosVM);
            }
            catch (Exception ex)
            {
                return(CustomBadRequest(ex));
            }
        }