Ejemplo n.º 1
0
        // 焦點專欄 - 內容
        public ActionResult EducationContent(int?eduTypeID, int?ID, int?pagingID)
        {
            if (!eduTypeID.HasValue || !ID.HasValue)
            {
                return(RedirectToAction("EducationList"));
            }

            //======語系取得========
            string langCd = GetLang();
            //======================

            EducationRepository repo  = new EducationRepository();
            EducationContent    model = repo.GetContentByID((int)eduTypeID, (int)ID, langCd);

            if (pagingID != null)
            {
                model.PagingID = (int)pagingID;
                var pagFirst = model.Data.PagingList.Where(s => s.ID == (int)pagingID).FirstOrDefault();
                if (pagFirst == null)
                {
                    return(RedirectToAction("FocusList", new { eduTypeID }));
                }
                pagFirst.Current = "current";
            }
            else
            {
                if (model.Data.PagingList.Count > 0)
                {
                    model.Data.PagingList.First().Current = "current";
                }
            }

            //=瀏覽記錄====================
            DataTable d_log;
            string    err_msg = "";

            DB.Log_Insert(eduTypeID.ToString(), "Edu");
            d_log = DB.Log_List(ref err_msg, eduTypeID.ToString(), "Edu");
            ViewData["log_count"] = d_log.Rows.Count.ToString();
            //============================

            return(View(model));
        }