Example #1
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var dbShow = db.GetShow(id.Value);

            if (dbShow == null)
            {
                return(HttpNotFound());
            }

            var show = new ShowViewModel
            {
                Id          = dbShow.Id,
                Name        = dbShow.Name,
                Seasons     = dbShow.Seasons,
                Episodes    = dbShow.Episodes,
                Description = dbShow.Description
            };

            return(View(show));
        }
Example #2
0
        public ActionResult Show(PagePath pagePath, string id)
        {
            var loadContext = _pageService.Load(pagePath);
            if (loadContext == null)
            {
                return this.RedirectToWikiPage(pagePath);
            }

            var tocBuilder = new TableOfContentsBuilder();
            tocBuilder.Compile(loadContext.Body);

            var tree = _pageTreeRepository.Get(loadContext.Page.Id);
            var model = new ShowViewModel
                            {
                                Body = loadContext.Body,
                                PagePath = pagePath,
                                Title = loadContext.Page.Title,
                                UpdatedAt = loadContext.Page.UpdatedAt,
                                UserName = loadContext.Page.UpdatedBy.DisplayName,
                                BackLinks = loadContext.Page.BackReferences.ToList(),
                                TableOfContents = tocBuilder.GenerateList(),
                                Path = tree.CreateLinksForPath(Url.WikiRoot())
                            };

            return View("Show", model);
        }
        public ViewResult Index(string SearchName = "", int page = 1)
        {
            ViewBag.Current        = "Products";
            TempData["SearchName"] = SearchName;

            IEnumerable <Stock> product = _stockRepository.StockItems;

            if (!String.IsNullOrEmpty(SearchName))
            {
                product = product.Where(o => o.Product.Name.ToUpper().Contains(SearchName.ToUpper()));
            }

            var viewModel = new ShowViewModel <Stock>
            {
                Items = product.Skip((page - 1) * _pageSize)
                        .Take(_pageSize),
                PagingInfo = new PagingInfo()
                {
                    CurrentPage  = page,
                    ItemsPerPage = _pageSize,
                    TotalItems   = product.Count()
                }
            };

            return(View(viewModel));
        }
Example #4
0
        public bool AddShow(ShowBindingModel show)
        {
            string urlPath = String.Format(Constants.GetSearch, GetSlug(show.Name));

            SearchInfoRoot data = WebParser <SearchInfoRoot> .GetInfo(urlPath);

            Show newShow = new Show()
            {
                Id             = data.data[0].id,
                Title          = data.data[0].seriesName,
                CurrentEpisode = show.CurrentEpisode,
                CurrentSeason  = show.CurrentSeason,
                Status         = show.Status
            };

            ShowViewModel newView = new ShowViewModel(newShow);

            if (!AddEpisodeInfo(newView))
            {
                if (data.data[0].status != "Continuing")
                {
                    return(false);
                }
            }

            Thread save = new Thread(AddAndSave);

            save.Start(newShow);

            //Insert the view into the collection
            HelperFunctions.PutInTheRightPlace <ShowViewModel>(views, newView);

            return(true);
        }
Example #5
0
        public bool EditShow(int id, ShowBindingModel show)
        {
            ShowViewModel toBeChanged = views.FirstOrDefault(v => v.Id == id);
            Show          chosen      = tvShows.FirstOrDefault(s => s.Id == id);

            if (toBeChanged != null)
            {
                views.Remove(toBeChanged);

                chosen.UpdateData(show);
                Thread save = new Thread(SaveShows);
                save.Start();

                toBeChanged = new ShowViewModel(chosen);
                if (!AddEpisodeInfo(toBeChanged))
                {
                    if (!IsOngoing(chosen))
                    {
                        return(false);
                    }
                }

                HelperFunctions.PutInTheRightPlace <ShowViewModel>(views, toBeChanged);

                return(true);
            }

            return(false);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.VideoPlayBack);

            _show = TwitApi.Instance.Shows.FirstOrDefault(s => s.Selected == true);
            if (_show == null)
            {
                // return to MainActivity
            }

            _episode = _show.Episodes.FirstOrDefault(e => e.Selected == true);
            if (_episode == null)
            {
                // return to MainActivity
            }


            _videoPlayer     = FindViewById <AdvancedVideoView>(Resource.Id.videoViewer);
            _mediaController = new MediaController(this, true);

            _videoPlayer.SetMediaController(_mediaController);
            string mediaUrl = Intent.GetStringExtra("VideoUrl");

            _videoPlayer.SetVideoPath(mediaUrl);

            // Create your application here
        }
        private int GetPlayBackPosition()
        {
            int           result = 0;
            ShowViewModel show   = TwitApi.Instance.Shows.FirstOrDefault(s => s.Selected == true);

            if (show != null)
            {
                EpisodeViewModel episode = show.Episodes.FirstOrDefault(e => e.Selected == true);
                if (episode != null)
                {
                    // If we find a show and episode, get the playback position. If not it will just start from the beginning.
                    string saveKey      = show.Show.Id + "|" + episode.Episode.Id + "|PlayBackPosition";
                    var    sharedPref   = this.GetSharedPreferences(SAVE_FILE_NAME, FileCreationMode.Private);
                    int    defaultValue = result;

                    result = sharedPref.GetInt(saveKey, defaultValue);

                    if (result < 0)
                    {
                        result = 0;
                    }
                }
            }
            return(result);
        }
Example #8
0
        public async Task <IActionResult> UpdateShow([FromRoute] int id, [FromBody] ShowViewModel show)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != show.ID)
            {
                return(BadRequest());
            }

            try
            {
                var updated = await _showsService.Update(show);

                return(Ok(updated));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (_showsService.GetById(id) == null)
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
        }
Example #9
0
        public void GenerateViews()
        {
            List <ShowViewModel> helper = new List <ShowViewModel>();

            for (int i = 0; i < tvShows.Count; i++)
            {
                ShowViewModel newModel = new ShowViewModel(tvShows[i]);

                if (!AddEpisodeInfo(newModel))
                {
                    if (!IsOngoing(tvShows[i]))
                    {
                        PermanentlyRemove(tvShows[i].Id);
                        i--;
                        continue;
                    }
                }

                helper.Add(newModel);
            }

            helper.Sort();

            views = new ObservableCollection <ShowViewModel>(helper);
        }
        protected override void OnResume()
        {
            base.OnResume();

            _show = TwitApi.Instance.Shows.FirstOrDefault(s => s.Selected == true);

            if (_show == null)
            {
                Android.Widget.Toast.MakeText(this, "Error finding show", Android.Widget.ToastLength.Short).Show();
                Intent intent = new Intent(this.ApplicationContext, typeof(MainActivity));
                StartActivity(intent);
                return;
            }
            Window.SetTitle(_show.Show.Label + " - Episodes");
            _titles.Clear();

            if (_show.Episodes.Count > 0)
            {
                foreach (EpisodeViewModel e in _show.Episodes)
                {
                    _titles.Add(e.Episode.EpisodeNumber + " - " + e.Episode.Label);
                }
            }
            _titles.Insert(0, "Refresh");
            ListView.Adapter = new ShowListViewAdatper(this, _titles.ToArray());
        }
Example #11
0
        public IActionResult Show(Participant participant, int id)
        {
            // Show company contacts

            var vm      = new ShowViewModel();
            var company = _companyRepository.GetBy(id);


            Group group;

            if (participant.Group != null)
            {
                group = _groupRepository.GetBy(participant.Group.GroupId);
            }
            else if (company.Label != null)
            {
                group = _groupRepository.GetBy(company.Label.Group.GroupId);
            }
            else
            {
                group = null;
            }

            vm.Company      = company;
            vm.Contacts     = vm.Company.Contacts;
            vm.Group        = group;
            vm.Motivation   = group?.Motivation;
            vm.Organization = group?.Organization;
            vm.Label        = company.Label;

            return(View(vm));
        }
Example #12
0
        public void ViewmodelShouldReturnGroupOfParticipant()
        {
            ViewResult    result = _controller.Edit(_ownerHogent, 1) as ViewResult;
            ShowViewModel vm     = (ShowViewModel)result?.Model;

            Assert.Equal(_ownerHogent.Group, vm.Group);
        }
Example #13
0
        public void ParticipantWhereGroupHasMotivationCanShowMotivation()
        {
            ViewResult    result = _controller.Edit(_ownerHogentSubmitted, 2) as ViewResult;
            ShowViewModel vm     = (ShowViewModel)result?.Model;

            Assert.Equal(_context.MotivationSubmitted.MotivationText, vm.Motivation.MotivationText);
        }
Example #14
0
        public List <ShowViewModel> GetAllShows(string userId)
        {
            var shows = new List <ShowViewModel>();

            var userShow    = GetUserShowViewModel();
            var generalShow = GetGeneralShowViewModel();

            foreach (var show in FilmHausDbContext.Shows.ToList())
            {
                var result = new ShowViewModel();

                if (UserShowRatingService.DoesUserHaveRating(userId, show.MediaId))
                {
                    result = userShow.Invoke(show.UserShows
                                             .Where(uf => uf.Id == userId && uf.MediaId == show.MediaId)
                                             .FirstOrDefault()
                                             );
                }
                else
                {
                    result = generalShow.Invoke(show);
                    result.InCurrentUserLibrary = UserShowService.IsShowInLibrary(show.MediaId, userId);
                }

                shows.Add(result);
            }

            return(shows);
        }
Example #15
0
        public void ParticipantWhereGroupHasNoMotivationCanCreateNewMotivationBecauseIsEmpty()
        {
            ViewResult    result = _controller.Edit(_ownerHogent, 1) as ViewResult;
            ShowViewModel vm     = (ShowViewModel)result?.Model;

            Assert.Null(vm.Motivation.MotivationText);
        }
        public void ParticipantCanShowLabelForCompany()
        {
            ViewResult    result = _controller.Show(_ownerApproved, 2) as ViewResult;
            ShowViewModel vm     = (ShowViewModel)result?.Model;

            Assert.NotNull(vm.Label);
        }
        public void ParticipantWithGroupCanSeeSubscribedGroup()
        {
            ViewResult    result = _controller.Show(_ownerHogent, 1) as ViewResult;
            ShowViewModel vm     = (ShowViewModel)result?.Model;

            Assert.Equal(_context.HogentGroup, vm.Group);
        }
        public void ParticipantWithGroupCanSeeInvitationsForGroup()
        {
            ViewResult    result = _controller.Show(_ownerHogent, 1) as ViewResult;
            ShowViewModel vm     = (ShowViewModel)result?.Model;

            Assert.Equal(_context.HogentGroup.Invitations, vm.Invitations);
        }
Example #19
0
 public PartialViewResult GetEpisodePartial(int id)
 {
     int ratingSum = 0;
     ShowViewModel ShowVM = new ShowViewModel();
     //EpisodeViewModel episodeVM = new EpisodeViewModel();
     var thisEpisode= context.episodes.Include("Show").Where(e => e.Id == id).FirstOrDefault();
     ShowVM.episodeVM.episode = thisEpisode;
     ShowVM.ShowTitle = thisEpisode.Show.Title;
     var Episodes = context.episodes.Where(e => e.ShowId == ShowVM.episodeVM.episode.ShowId).OrderByDescending(e => e.Id);
     var previousShows = Episodes.ToList();
     ShowVM.episodes = previousShows;
     ShowVM.episodeVM.comments = context.comments.Include("ApplicationUser").Where(c => c.EpisodeId == id).OrderByDescending(e => e.Id).ToList();
     string userId = User.Identity.GetUserId();
     ShowVM.episodeVM.currentUserRating = context.Ratings.Where(c => c.EpisodeId ==id).Where(c => c.UserId == userId).Select(c => c.Score).FirstOrDefault();
     List<Rating> ratings = context.Ratings.Where(r => r.EpisodeId == id).ToList();
     if (ratings.Count > 0)
     {
         foreach (Rating rating in ratings)
         {
             ratingSum += rating.Score;
         }
         ShowVM.episodeVM.rating = ratingSum / ratings.Count;
     }
     return PartialView("_EpisodePartial", ShowVM);
 }
        public ActionResult Show(string userId = "")
        {
            if (string.IsNullOrWhiteSpace(userId))
            {
                return(RedirectToAction("Index"));
            }

            AppUser user = UserManager.FindById(userId);

            if (user.Grad == null)
            {
                return(RedirectToAction("Index"));
            }

            string        Tip       = GetUserRole(user);
            ShowViewModel viewModel = new ShowViewModel
            {
                Ime      = user.Ime,
                Prezime  = user.Prezime,
                Username = user.UserName,
                Email    = user.Email,
                Tip      = Tip,
                Grad     = user.Grad.Naziv,
                Kursevi  = GetKursevi(user, Tip)
            };

            return(View(viewModel));
        }
Example #21
0
        public IActionResult Show(string id)
        {
            ShowViewModel model = new ShowViewModel();

            model.Id = id;
            return(View(model));
        }
Example #22
0
        public async Task <IActionResult> Show(string id, int page = 1)
        {
            // never go below 1
            page = Math.Max(1, page);

            var currentRepository = appSettings.Find(id);

            if (currentRepository == null)
            {
                return(NotFound());
            }

            var releases = await GetAllReleases(currentRepository, page);

            if (releases == null)
            {
                return(View(new ShowViewModel(currentRepository)));
            }

            var model = new ShowViewModel(currentRepository)
            {
                Releases     = releases.Releases.Select(x => new ReleaseViewModel(currentRepository, x)).ToList(),
                Page         = releases.Page,
                PageSize     = releases.PageSize,
                FirstPage    = releases.FirstPage,
                NextPage     = releases.NextPage,
                PreviousPage = releases.PreviousPage,
                LastPage     = releases.LastPage
            };

            return(View(model));
        }
        public ActionResult CreateNewShow(ShowViewModel obj)
        {
            if (ModelState.IsValid)
            {
                if (obj.show.ShowId == 0)
                {
                    db.Shows.Add(obj.show);
                    db.SaveChanges();
                    return(RedirectToAction("Index", "Show"));
                }
            }



            Show oShow = new Show();

            oShow.ScreenId = fetchingId;

            ShowViewModel obj1           = new ShowViewModel();
            var           today          = DateTime.Now;
            var           onemonthbefore = today.AddMonths(-1);

            obj1.movieList = db.Movies.Where(temp => temp.DateRelease >= onemonthbefore).OrderByDescending(temp => temp.DateRelease).ToList();



            obj1.show   = oShow;
            obj1.screen = db.Screens.SingleOrDefault(temp => temp.ScreenId == fetchingId);



            return(View("ShowForm", obj1));
        }
        //[HandleError, OrchardAuthorization(PermissionName = OrchardPermissionStrings.SiteOwner)]
        public ActionResult Show(ShowInputModel inputModel)
        {
            int performanceMonitorRecordId = inputModel.PerformanceMonitorRecord_Id;

            ShowViewModel viewModel = _performanceMonitorWorkerService.Show(performanceMonitorRecordId);

            viewModel.PerformanceMonitorRecord_Id = performanceMonitorRecordId;

            if (inputModel.AutoRefresh == true)
            {
                viewModel.AutoRefresh = true;
            }
            else
            {
                viewModel.AutoRefresh = false;
            }

            PerformanceMonitorRecord currentMonitorRecord = _performanceMonitorWorkerService.GetPerformanceMonitorRecord(performanceMonitorRecordId);

            int    maxLength         = 20;
            string labelCounter      = string.Empty;
            var    counterNameString = currentMonitorRecord.CounterName;

            if (counterNameString.Length <= maxLength)
            {
                labelCounter = counterNameString;
            }
            else
            {
                labelCounter = Truncate(counterNameString, maxLength);
                labelCounter = string.Concat(labelCounter, "...");
            }
            viewModel.LabelCounter   = labelCounter;
            viewModel.Threshold      = currentMonitorRecord.Threshold;
            viewModel.ThresholdWhen  = currentMonitorRecord.ThresholdWhen;
            viewModel.SampleInterval = currentMonitorRecord.SampleInterval;

            viewModel.MeanValue    = currentMonitorRecord.Mean;
            viewModel.MinimumValue = currentMonitorRecord.Minimum;
            viewModel.MaximumValue = currentMonitorRecord.Maximum;

            List <PerformanceMonitorDataRecord> dataRecordsToShow = _performanceMonitorWorkerService.Plot(performanceMonitorRecordId);

            viewModel.LineName   = "Countervalues";
            viewModel.LabelAxisY = currentMonitorRecord.CounterName.ToString();
            viewModel.id         = 1;
            viewModel.data       = new List <PlotDataViewModel>();

            foreach (PerformanceMonitorDataRecord dataRecord in dataRecordsToShow)
            {
                double valueCount = double.Parse(dataRecord.Count);
                viewModel.data.Add(new PlotDataViewModel()
                {
                    Ticks = dataRecord.Ticks,
                    Value = valueCount
                });
            }
            return(View(viewModel));
        }
        public void ParticipantCanSeeTheCompanyNameAndItsContacts()
        {
            ViewResult    result = _controller.Show(_ownerApproved, 2) as ViewResult;
            ShowViewModel vm     = (ShowViewModel)result?.Model;

            Assert.Equal(_context.Company2, vm.Company);
            Assert.NotNull(vm.Contacts);
        }
Example #26
0
        public ShowPage()
        {
            InitializeComponent();

            ViewModel = (ShowViewModel)DataContext;

            InitializeFrostedGlass(FrostedGlassPanel);
        }
Example #27
0
        public async Task <ShowViewModel> Update(ShowViewModel show)
        {
            var dbModel = ToShowModel(show);
            var updated = _context.Shows.Update(dbModel);
            await _context.SaveChangesAsync();

            return(ToShowViewModel(updated.Entity));
        }
Example #28
0
 public MainViewModel()
 {
     instance        = this;
     this.Login      = new LoginViewModel();
     this.Register   = new RegisterViewModel();
     this.Home       = new HomeViewModel();
     this.Insert     = new InsertViewModel();
     this.Show       = new ShowViewModel();
     this.Preference = new PreferencesViewModel();
 }
Example #29
0
        public ActionResult Yardline()
        {
            ShowViewModel showVM = new ShowViewModel();
            var Show = context.shows.FirstOrDefault(s => s.Title == "The 60 Yard Line");
            var ShowId = Show.Id;
            var Episodes = context.episodes.Where(e => e.ShowId == ShowId).OrderByDescending(e => e.Id).ToList();
            //var latestShowLink = Episodes.FirstOrDefault().SoundCloudLink;
            //string showUrl = "https://w.soundcloud.com/player/?url=" + latestShowLink;
            //ViewBag.ShowUrl = showUrl;
            var previousShows = Episodes;
            //ViewBag.PreviousShows
            if (Show.TwitterAccount != null)
            {
                string twitterUrl = Show.TwitterAccount + "?ref_src = twsrc % 5Etfw";
                ViewBag.Twitter = Show.TwitterAccount;
            }
            ViewBag.Itunes = Show.ItunesLink;
            ViewBag.Img = Show.Image;
            ViewBag.ShowDetails = Show.Details;
            var UserId = User.Identity.GetUserId();
            if (UserId != null)
            {
                var textSignups = context.texts.Where(t => t.UserId == UserId);
                var isSignedUp = textSignups.Where(t => t.ShowId == ShowId).FirstOrDefault();
                if (isSignedUp != null)
                {
                    ViewBag.SignedUp = true;
                }
            }
            showVM.episodes = previousShows;
            showVM.ShowTitle = "Nick @ Night";
            int EpisodeId = GetMostRecentEpisodeId(ShowId);
            //List<Comment> episodeComments

            List<Rating> ratings = context.Ratings.Where(r => r.EpisodeId == EpisodeId).ToList();
            int ratingSum = 0;
            if (ratings.Count > 0)
            {
                foreach (Rating rating in ratings)
                {
                    ratingSum += rating.Score;
                }
                showVM.episodeVM.rating = ratingSum / ratings.Count;
            }

            showVM.episodeVM.episode = context.episodes.Where(e => e.Id == EpisodeId).FirstOrDefault();
            showVM.episodeVM.comments = context.comments.Include("ApplicationUser").Where(c => c.EpisodeId == EpisodeId).OrderByDescending(e => e.Id).ToList();

            string userId = User.Identity.GetUserId();
            showVM.episodeVM.currentUserRating = context.Ratings.Where(c => c.EpisodeId == EpisodeId).Where(c => c.UserId == userId).Select(c => c.Score).FirstOrDefault();

            //ViewBag.PatreonSupporters = PatreonMessenger.GetPatrons();
            return View(showVM);
        }
Example #30
0
        public async Task <IActionResult> CreateShow([FromBody] ShowViewModel show)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var created = await _showsService.Create(show);

            return(CreatedAtAction("GetShow", new { id = show.ID }, created));
        }
        public ActionResult CreateNewShow(ShowViewModel obj)
        {
            if (ModelState.IsValid)
            {
                if (obj.show.ShowId == 0)
                {
                    //db.Shows.Add(obj.show);  //updatehere
                    //db.SaveChanges();

                    using (var client = new HttpClient())
                    {
                        client.BaseAddress = new Uri("http://localhost:50301/api/student");

                        //HTTP POST
                        var postTask = client.PostAsJsonAsync <Show>("ShowWebApi", obj.show);
                        postTask.Wait();

                        var result = postTask.Result;
                        if (result.IsSuccessStatusCode)
                        {
                            return(RedirectToAction("Index", "Show"));
                        }

                        else
                        {
                            return(Content("Server Error. Please contact administrator."));
                        }
                    }


                    //  return RedirectToAction("Index", "Show");
                }
            }

            Show oShow = new Show();

            oShow.ScreenId = fetchingId;

            ShowViewModel obj1           = new ShowViewModel();
            var           today          = DateTime.Now;
            var           onemonthbefore = today.AddMonths(-1);

            // obj1.movieList = db.Movies.Where(temp => temp.DateRelease >= onemonthbefore).OrderByDescending(temp => temp.DateRelease).ToList();

            obj1.movieList = getMovieList().Where(temp => temp.DateRelease >= onemonthbefore).OrderByDescending(temp => temp.DateRelease).ToList();


            obj1.show = oShow;
            // obj1.screen = db.Screens.SingleOrDefault(temp => temp.ScreenId == fetchingId);

            obj1.screen = getScreenList().SingleOrDefault(temp => temp.ScreenId == fetchingId);

            return(View("ShowForm", obj1));
        }
 //展示文本文档
 public async Task<ActionResult> Show(string ResourceId)
 {
     ViewBag.Title = "文档";
     ShowViewModel viewModel = new ShowViewModel();
     viewModel.Resource = await ResourceService.getResourceById(ResourceId);
     Session["CourseId"] = viewModel.Resource.Course.CourseId;
     viewModel.Group = await ResourceGroupService.GetResourceGroupByGroupId(viewModel.Resource.ResourceGroup.GroupId);
     MarkModel Lovemodel = new MarkModel();
     if (Session["LoginUser"] != null)
     {
         Lovemodel.User = Session["LoginUser"] as UserModel;
         MarkModel Learnmodel = new MarkModel();
         Learnmodel.User = Session["LoginUser"] as UserModel;
         Learnmodel.MarkType = await MarkTypeService.getMarkTypeByTypeName("观看");
         Learnmodel.Resource = await ResourceService.getResourceById(ResourceId);
         if (!await MarkService.MarkIsExist(Learnmodel))
         {
             await MarkService.CreatLearned(Learnmodel);
         }
         Lovemodel.MarkType = await MarkTypeService.getMarkTypeByTypeName("收藏");
         Lovemodel.Resource = await ResourceService.getResourceById(ResourceId);
         if (await MarkService.MarkIsExist(Lovemodel))
         {
             viewModel.IsLove = true;
         }
         else
         {
             viewModel.IsLove = false;
         }
     }
     if (viewModel.Group.GroupName.ToString().Trim() != "不分组")
     {
         viewModel.GroupResourceList = await ResourceService.getResourceByGroup(viewModel.Group.GroupId);
     }
     else
     {
         viewModel.GroupResourceList = new List<ResourceModel>();
     }
     return View(viewModel);
 }