Example #1
0
        public IActionResult Create(int id, Story sty)
        {
            var model = StoryList.getInstance();

            model.add(sty);
            return(RedirectToAction("Index"));
        }
Example #2
0
        //----< 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"));
        }
Example #3
0
        public IActionResult Edit(int id, Story sty)
        {
            var model = StoryList.getInstance();

            model[id - 1] = sty;
            return(RedirectToAction("Index"));
        }
Example #4
0
        public IActionResult Edit(int id)
        {
            var styList = StoryList.getInstance();
            var model   = styList[id - 1];

            return(View(model));
        }
Example #5
0
        //----< shows details for each story >----------------------
        public ViewResult Details(int id)
        {
            var model = StoryList.getInstance();
            var sty   = model[id - 1];

            return(View(sty));
        }
Example #6
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            var model = StoryList.getInstance();
            IEnumerable <Story> crsLst = (IEnumerable <Story>)model.Stories;

            return(View(crsLst));
        }
Example #7
0
        public IActionResult Create(int id)
        {
            var styList = StoryList.getInstance();

            var model = new Story();

            model.Id = styList.size() + 1;
            return(View(model));
        }
Example #8
0
        public void add(Story story)
        {
            StoryList storyList = StoryList.getInstance();

            storyList.add(story);
        }
Example #9
0
        public Story getById(int id)
        {
            StoryList storyList = StoryList.getInstance();

            return(storyList[id]);
        }
Example #10
0
        public IEnumerable <Story> getAll()
        {
            StoryList storyList = StoryList.getInstance();

            return(storyList);
        }