Example #1
0
        public ActionResult Edit(int id, [Bind("Id,Title,StartTime,EndTime,ShowId,Active")] Rundown rundown)
        {
            if (id != rundown.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    db.Update(rundown);
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RundownExists(rundown.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Show"] = new SelectList(db.Shows, "Id", "Title", rundown.ShowId);
            return(View(rundown));
        }
Example #2
0
        // GET: Rundown/Create
        public ActionResult Create()
        {
            var model = new Rundown()
            {
                Active = true
            };
            var vm = new RundownViewModel(model);

            ViewData["Show"] = new SelectList(db.Shows, "Id", "Title");
            return(View(vm));
        }
Example #3
0
 public RundownOverviewViewModel(Rundown model)
 {
     this.Id        = model.Id;
     this.Title     = model.Title;
     this.StartTime = model.StartTime;
     this.ShowId    = model.ShowId;
     this.ShowTitle = model.Show?.Title;
     this.ShowColor = model.Show?.Color;
     this.EndTime   = model.EndTime;
     if (model.Stories is null)
     {
         model.Stories = new List <Story>();
     }
     model.Stories.ForEach(x => Stories.Add(new StoryViewModel(x)));
     this.Active = model.Active;
 }
Example #4
0
 public RundownViewModel(Rundown model)
 {
     Id        = model.Id;
     Title     = model.Title;
     StartTime = model.StartTime;
     EndTime   = model.EndTime;
     ShowId    = model.ShowId;
     Show      = model.Show;
     EndTime   = model.EndTime;
     if (model.Stories is null)
     {
         model.Stories = new List <Story>();
     }
     model.Stories.ForEach(x => Stories.Add(new StoryViewModel(x)));
     Active = model.Active;
 }