Exemplo n.º 1
0
        public void SaveNews(News News)
        {
            if (News.Id == 0)
            {

                _RNews.Add(News);
            }
            else
            {
                _uow.Entry(News).State = EntityState.Modified;
            }
            _uow.SaveChanges();
        }
Exemplo n.º 2
0
        public ActionResult SaveNews(string Title, string ShortDes, string LongDes, bool IsShow, string Tags ,string metaDescription)
        {
            if (IsValidSessions())
            {

                TempData["result"] = "OK";
                News News = new News();
                News.IsShow = IsShow;
                News.Title = Title;
                News.ShortDes = ShortDes;
                News.LongDes = LongDes;
                News.Tags = Tags;
                News.metaDescription = metaDescription;
                News.LanguageId = Convert.ToInt32(Session["Language"].ToString());
                News.CreationDate = DateTime.Now.Date;
                _RNews.SaveNews(News);
                TempData["Folder"] = News.Id;
                TempData["result"] = "OK";
                TempData["Message"] = "عملیات با موفقیت انجام شد.";
                return Json(new { Idms = News.Id }, JsonRequestBehavior.AllowGet);

            }
            else
                return RedirectToAction("Login", "Home");
        }
Exemplo n.º 3
0
 public void DeleteNews(News News)
 {
     _RNews.Remove(News);
     _uow.SaveChanges();
 }