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

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

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

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

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

            return(View(crsLst));
        }
Beispiel #7
0
        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);
        }