public IActionResult Create(int id, Story sty) { var model = StoryList.getInstance(); model.add(sty); return(RedirectToAction("Index")); }
//----< deletes a story by id >----------------------------- /* * - note that Delete does not send back a view, but * simply redirects back to the Index view, which * will not show the deleted course because it was ... */ public IActionResult Delete(int id) { var styList = StoryList.getInstance(); styList.delete(id - 1); return(RedirectToAction("Index")); }
public IActionResult Edit(int id, Story sty) { var model = StoryList.getInstance(); model[id - 1] = sty; return(RedirectToAction("Index")); }
public IActionResult Edit(int id) { var styList = StoryList.getInstance(); var model = styList[id - 1]; return(View(model)); }
//----< shows details for each story >---------------------- public ViewResult Details(int id) { var model = StoryList.getInstance(); var sty = model[id - 1]; return(View(sty)); }
// GET: /<controller>/ public IActionResult Index() { var model = StoryList.getInstance(); IEnumerable <Story> crsLst = (IEnumerable <Story>)model.Stories; return(View(crsLst)); }
public IActionResult Create(int id) { var styList = StoryList.getInstance(); var model = new Story(); model.Id = styList.size() + 1; return(View(model)); }
public void add(Story story) { StoryList storyList = StoryList.getInstance(); storyList.add(story); }
public Story getById(int id) { StoryList storyList = StoryList.getInstance(); return(storyList[id]); }
public IEnumerable <Story> getAll() { StoryList storyList = StoryList.getInstance(); return(storyList); }