Exemplo n.º 1
0
 public ActionResult Create([Bind("StoryId,Title")] Story story)
 {
     if (ModelState.IsValid)
     {
         _context.Add(story);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(story));
 }
Exemplo n.º 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));
 }
Exemplo n.º 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));
 }
Exemplo n.º 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));
 }