public ActionResult CreateNews()
 {
     var model = new NewsArticle();
     var categories = from CategoriesEnum s in Enum.GetValues(typeof(CategoriesEnum))
                      select new { Name = s.ToString().Replace('_', ' ') };
     ViewBag.CategoriesName = new SelectList(categories, "Name", "Name");
     return View(model);
 }
        public ActionResult CreateNews(NewsArticle model)
        {
            ViewBag.HtmlContent = model.Content;
            model.Date = DateTime.Now;

            model.UsersId = WebMatrix.WebData.WebSecurity.GetUserId(User.Identity.Name);

            if (ModelState.IsValid)
            {

                db.NewsArticle.Add(model);
                db.SaveChanges();
                return RedirectToAction("Index");
                //return RedirectToAction("Index", "NewsArticle");  // Success

            }

            return View(model);
        }
        public ActionResult EditNews(NewsArticle news)
        {
            // TODO: Add update logic here
                news.UsersId = WebMatrix.WebData.WebSecurity.GetUserId(User.Identity.Name);
                if (ModelState.IsValid)
                {
                    db.Entry(news).State = EntityState.Modified;
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }

                return View(news);
        }