예제 #1
0
        //// GET: ShowItem
        //public ActionResult Index()
        //{
        //    string idstr = Request.QueryString["id"];
        //    int id = 0;
        //    if (idstr == null || !Int32.TryParse(idstr, out id))
        //    {
        //        return View("error");
        //    }

        //    LayoutViewModel masterModel = new LayoutViewModel(db);
        //    ArticleContent model = db.ArticleContents.Find(id);
        //    // 根据不同的类型可以把title改下
        //    AcTypeEmun typeEnum = (AcTypeEmun)Enum.Parse((typeof(AcTypeEmun)), model.ACType);
        //    string emumtext = RemarkAttribute.GetEnumRemark(typeEnum);
        //    ViewBag.Title = "吉家尚" + emumtext + "详情页";
        //    ViewBag.Content = model.AContent;
        //    masterModel.groupBuilds = db.ArticleContents
        //                                .Where(w => w.ACType == AcTypeEmun.GROUPBUILD.ToString().ToUpper())
        //                                .Take(4).OrderBy(o => new { o.ACSortNum, o.InDateTime })
        //                                .OrderBy(o => o.ACSortNum).ToList();

        //    return View(masterModel);
        //}

        /// <summary>
        /// 热门套餐,经典案例,团装,家居设计,环保装修详情页
        /// </summary>
        /// <returns></returns>
        public ActionResult ArticleContent()
        {
            string idstr = Request.QueryString["id"];
            int    id    = 0;

            if (idstr == null || !Int32.TryParse(idstr, out id))
            {
                return(View("error"));
            }

            ArticleContent model = db.ArticleContents.Find(id);

            if (model == null)
            {
                return(View("error"));
            }

            // 根据不同的类型可以把title改下
            AcTypeEmun typeEnum = (AcTypeEmun)Enum.Parse((typeof(AcTypeEmun)), model.ACType);
            string     emumtext = RemarkAttribute.GetEnumRemark(typeEnum);

            ViewBag.Title   = "吉家尚" + emumtext + "详情页";
            ViewBag.Content = model.AContent;

            LayoutViewModel masterModel = new LayoutViewModel(db);

            masterModel.groupBuilds = db.ArticleContents
                                      .Where(w => w.ACType == AcTypeEmun.GROUPBUILD.ToString().ToUpper())
                                      .Take(4).OrderBy(o => new { o.ACSortNum, o.InDateTime })
                                      .OrderBy(o => o.ACSortNum).ToList();


            return(View(masterModel));
        }
예제 #2
0
        // GET: ArticleContents/Details/5
        public ActionResult Details()
        {
            string idnum = Request.QueryString["id"];
            int    id    = 0;

            if (!Int32.TryParse(idnum, out id))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ArticleContent articleContent = db.ArticleContents.Find(id);

            if (articleContent == null)
            {
                return(HttpNotFound());
            }

            AcTypeEmun typeEnum = AcTypeEmun.ROLL;

            typeEnum = (AcTypeEmun)Enum.Parse((typeof(AcTypeEmun)), articleContent.ACType);
            string emumtext = RemarkAttribute.GetEnumRemark(typeEnum);

            ViewBag.TypeText      = emumtext;
            ViewBag.TypeNum       = (int)typeEnum;
            ViewBag.Content       = articleContent.AContent;
            articleContent.ACType = emumtext;

            string pagenum = "_";

            if (typeEnum == AcTypeEmun.GROUPBUILD || typeEnum == AcTypeEmun.HOMEDESIGN || typeEnum == AcTypeEmun.ENVIRONMENTAL)
            {
                pagenum += "4";
            }
            else
            {
                pagenum += ((int)typeEnum).ToString();
            }

            if (typeEnum == AcTypeEmun.CLASSCASE)
            {
                foreach (var item in db.Designers)
                {
                    if (articleContent.DId == item.Id)
                    {
                        ViewBag.DesignerName = item.DName + "_" + item.DUniversity + "_" + item.DDepartment;
                    }
                }
            }
            return(View("Details" + pagenum, articleContent));
        }
예제 #3
0
        // GET: ArticleContents
        public ActionResult Index()
        {
            string typestr = Request.QueryString["type"];
            int    type    = 0;

            if (typestr == null || !Int32.TryParse(typestr, out type) || !Enum.IsDefined(typeof(AcTypeEmun), type))
            {
                return(View("error"));
            }
            if (type.Equals("0"))
            {
                return(View("error"));
            }
            ViewBag.TypeText = RemarkAttribute.GetEnumRemark((AcTypeEmun)type);
            ViewBag.TypeNum  = type;
            var        list     = new List <ArticleContent>();
            string     pagenum  = "_";
            AcTypeEmun typeEnum = (AcTypeEmun)type;
            string     enumText = RemarkAttribute.GetEnumRemark(typeEnum);

            if (typeEnum == AcTypeEmun.GROUPBUILD || typeEnum == AcTypeEmun.HOMEDESIGN || typeEnum == AcTypeEmun.ENVIRONMENTAL)
            {
                pagenum += "4";
            }
            else
            {
                pagenum += type.ToString();
            }

            if (!db.ArticleContents.Any())
            {
                return(View("Index" + pagenum, list));
            }

            list = db.ArticleContents
                   .Where(w => w.ACType == ((AcTypeEmun)type).ToString())
                   .OrderBy(o => new { o.ACSortNum, o.InDateTime })
                   .ToList();

            if (list.Any())
            {
                list.ForEach(f => { f.ACType = enumText; });
            }


            return(View("Index" + pagenum, list));
        }