public ActionResult Edit(News news) { if (ModelState.IsValid) { News1Controller newsApi = new News1Controller(); newsApi.editNews(news.id, news); return(RedirectToAction("Index")); } return(View(news)); }
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()); } }
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)); }
// GET: News public ActionResult Index() { News1Controller newsApi = new News1Controller(); return(View(newsApi.Getnews().newsList)); }