예제 #1
0
        public JsonResult ArchiveNews(int year)
        {
            IList <News> news = Db.News.Where(l => l.Year == year && l.Archive == false).ToList();

            News    temp;
            Archive temp2 = new Archive();

            int arhciveId = Db.Archives.Select(j => j.ArchiveId).Max() + 1;

            temp2.ArchiveId = arhciveId;
            temp2.Year      = year;

            foreach (var item in news)
            {
                temp            = Db.News.Where(n => n.NewsId == item.NewsId).FirstOrDefault();
                temp.Archive    = true;
                temp.Name       = item.Name;
                temp.Text       = item.Text;
                temp.Year       = item.Year;
                temp.Ord        = item.Ord;
                temp.LanguageId = item.LanguageId;

                Db.SaveChanges();

                temp2.News.Add(temp);
            }

            Db.Archives.Add(temp2);
            Db.SaveChanges();
            NewsListModel model = NewsBuilder.BuildNews(Db);


            return(Json(ResponseStatus.Success, RenderPartialViewToString("News", model), JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public ActionResult News()
        {
            NewsListModel model = NewsBuilder.BuildNews(Db);

            ViewBag.Link = 4;
            return(View(model));
        }
예제 #3
0
        public ActionResult News()
        {
            var lngId = 1;

            if (Session["lngId"] != null)
            {
                lngId = (int)Session["lngId"];
            }

            NewsListModel model = NewsBuilder.BuildNews(Db);

            model.ContentRight = Db.Labels.Where(m => m.ViewId == "News" && m.ElementId == "ContentRight" && m.LanguageId == lngId).FirstOrDefault().Text;
            ViewBag.Link       = 4;
            return(View(model));
        }