예제 #1
0
        public ActionResult Edit(News news)
        {
            if (ModelState.IsValid)
            {
                News1Controller newsApi = new News1Controller();

                newsApi.editNews(news.id, news);

                return(RedirectToAction("Index"));
            }
            return(View(news));
        }
예제 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            News            news    = db.news.Find(id);
            News1Controller newsApi = new News1Controller();

            if (newsApi.Delete(id).Status)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View());
            }
        }
예제 #3
0
        public ActionResult Create(News news)
        {
            if (ModelState.IsValid)
            {
                News1Controller newsApi = new News1Controller();
                if (newsApi.PostNews(news).Status)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View());
                }
            }

            return(View(news));
        }
예제 #4
0
        // GET: News
        public ActionResult Index()
        {
            News1Controller newsApi = new News1Controller();

            return(View(newsApi.Getnews().newsList));
        }