Exemplo n.º 1
0
        public ActionResult Index()
        {
            #region Set PopVM
            PopVM pop = new PopVM();
            pop.Channels.AddRange(dbo.GetAllChannels());

            IEnumerable <SelectListItem> popular = db.PopularContent
                                                   .Select(c => new SelectListItem
            {
                Value = c.Id.ToString(),
                Text  = c.Schedule.Show.Name,
            });
            ViewBag.Pops = popular;

            IEnumerable <SelectListItem> schedules = db.Schedule
                                                     .Select(c => new SelectListItem
            {
                Value = c.Id.ToString(),
                Text  = c.Show.Name
            });
            ViewBag.Schedule = schedules;
            #endregion

            return(View(pop));
        }
Exemplo n.º 2
0
        public void UpdatePopularContent(PopVM model)
        {
            int            popular = model.Id;
            PopularContent pc      = new PopularContent();

            pc            = db.PopularContent.Find(popular);
            pc.ScheduleId = model.ScheduleId;
            pc.ImgUrl     = "img/" + model.ImgUrl;
            pc.Icon       = "mdi mdi-television";

            db.Entry(pc).State = EntityState.Modified;
            db.SaveChanges();
        }
Exemplo n.º 3
0
        public ActionResult GetForm(PopVM model)
        {
            if (ModelState.IsValid)
            {
                #region Update

                dbo.UpdatePopularContent(model);

                #endregion
            }
            else
            {
                ModelState.AddModelError(string.Empty, "En bild måste anges!");
            }

            return(RedirectToAction("Index", "Admin"));
        }