Beispiel #1
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));
        }
Beispiel #2
0
 public ActionResult Create([Bind("Id,Title,StartTime,EndTime,ShowId,Active")] RundownViewModel rundown)
 {
     if (ModelState.IsValid)
     {
         db.Add(rundown);
         db.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     ViewData["Show"] = new SelectList(db.Shows, "Id", "Title", rundown.ShowId);
     return(View(rundown));
 }
Beispiel #3
0
        // GET: Rundown/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var rundown = db.Rundowns.Include(r => r.Show).FirstOrDefault(m => m.Id == id);

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

            var rundownVM = new RundownViewModel(rundown);

            return(View(rundownVM));
        }
Beispiel #4
0
        // GET: Rundown/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var rundown = db.Rundowns.Where(r => r.Id == id).Include(r => r.Show).Include(r => r.Stories).FirstOrDefault();

            if (rundown == null)
            {
                return(NotFound());
            }
            var rundownVM = new RundownViewModel(rundown);

            ViewData["Show"] = new SelectList(db.Shows, "Id", "Title", rundownVM.ShowId);

            return(View(rundownVM));
        }