public ActionResult Create() { KPMGNews.Models.LoginData logindata = new KPMGNews.Models.LoginData(HttpContext); if (!logindata.usertype().Equals("Publisher")) { return(RedirectToAction("Index", "News", null)); } return(View()); }
public ActionResult DeleteConfirmed(int id) { KPMGNews.Models.LoginData logindata = new KPMGNews.Models.LoginData(HttpContext); if (!logindata.usertype().Equals("Publisher")) { return(RedirectToAction("Index", "News", null)); } News news = db.NewsArticle.Find(id); news.deleted = true; //db.NewsArticle.Remove(news); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "NewsID,Text,UserID,timestamp,deleted")] News news) { KPMGNews.Models.LoginData logindata = new KPMGNews.Models.LoginData(HttpContext); if (!logindata.usertype().Equals("Publisher")) { return(RedirectToAction("Index", "News", null)); } if (ModelState.IsValid) { news.timestamp = DateTime.Now; news.UserID = Convert.ToInt32(HttpContext.Session["UserID"]); news.deleted = false; db.Entry(news).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(news)); }
public ActionResult Edit(int?id) { KPMGNews.Models.LoginData logindata = new KPMGNews.Models.LoginData(HttpContext); if (!logindata.usertype().Equals("Publisher")) { return(RedirectToAction("Index", "News", null)); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } News news = db.NewsArticle.Find(id); if (news == null) { return(HttpNotFound()); } return(View(news)); }
// GET: Accounts/Create public ActionResult LogOut() { KPMGNews.Models.LoginData logindata = new KPMGNews.Models.LoginData(this.HttpContext); logindata.LogOut(); return(RedirectToAction("Login", "Accounts", null)); }