public ActionResult BlogStrip()
        {
            DbBlogContext dbblog   = new DbBlogContext();
            string        bloglang = LanguageSetting.Lang == "it" ? "it" : "en";

            List <resource_content>   res = dbblog.resource_content.Where(x => x.parentname == "post" && (x.lang == bloglang || x.lang == bloglang + "-all")).OrderByDescending(x => x.id).Skip(0).Take(50).ToList();
            List <ResourceModelDatas> rmd = new List <ResourceModelDatas>();

            res.ForEach(
                x =>
            {
                ResourceModelDatas rd = new ResourceModelDatas();

                rd.id          = x.id;
                rd.idrisorsa   = x.idrisorsa;
                rd.isinvariant = false;
                rd.itemgroup   = x.itemgroup;
                rd.lang        = x.lang;
                rd.name        = x.name;
                rd.ordinamento = x.ordinamento;
                rd.rname       = x.parentname;
                rd.tipo        = x.tipo;
                rd.val         = x.val;
                rmd.Add(rd);
            }
                );


            List <BlogPost> p = new List <BlogPost>();

            p.fill(rmd);


            return(PartialView("_BlogStrip", p.Skip(0).Take(3).ToList()));
        }
Beispiel #2
0
 public BlogsController(DbBlogContext context)
 {
     _context = context;
 }