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