public ActionResult Create([Bind("StoryId,Title")] Story story)
 {
     if (ModelState.IsValid)
     {
         _context.Add(story);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(story));
 }
Example #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));
 }
Example #3
0
 public ActionResult Create([Bind("SegmentId,Type,Reader,EstimatedReadTime,ActualReadTime,StoryId")] Segment segment)
 {
     if (ModelState.IsValid)
     {
         _context.Add(segment);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     ViewData["StoryId"] = new SelectList(_context.Stories, "StoryId", "StoryId", segment.StoryId);
     return(View(segment));
 }
Example #4
0
 public ActionResult Create([Bind("Id,Title,Active,Color")] Show show)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _context.Add(show);
             _context.SaveChanges();
             return(RedirectToAction(nameof(Index)));
         } catch (Exception ex)
         {
             return(View(show));
         }
     }
     return(View(show));
 }