コード例 #1
0
        /// <summary>
        ///  发现电子书
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Discovery(int id)
        {
            List<TypeDictionary> types = new List<TypeDictionary>();
            types = db.TypeDictionaries.Where(t => t.Belonger == TypeBelonger.电子书 && t.FatherID == 0).ToList();
            ViewBag.Tid = id;
            var type = new TypeDictionary();
            if (id != 0)
            {
                type = db.TypeDictionaries.Find(id);
            }
            ViewBag.Type = id;

            ViewBag.Types = types;
            return View();
        }
コード例 #2
0
 // GET: EBook
 public ActionResult Index()
 {
     string tid = HttpContext.Request.QueryString["tid"].ToString();
     ViewBag.Tid = tid;
     var lstBooks = db.EBooks.OrderByDescending(b => b.Browses).Take(8).ToList();
     var type = new TypeDictionary();
     if (tid != "0")
     {
         int id = Convert.ToInt32(tid);
         type = db.TypeDictionaries.Find(id);
     }
     ViewBag.Type = type.TypeValue;
     ViewBag.EBooks = lstBooks;
     return View();
 }
コード例 #3
0
 /// <summary>
 /// 课程列表显示
 /// </summary>
 /// <returns></returns>
 public ActionResult Discovery(int? id)
 {
     List<TypeDictionary> types = new List<TypeDictionary>();
     types = db.TypeDictionaries.Where(t => t.Belonger == TypeBelonger.课程 && t.FatherID == 0).OrderBy(t => t.PID).ToList();
     ViewBag.Tid = id;
     var type = new TypeDictionary();
     if (id != 0 && id != null)
     {
         type = db.TypeDictionaries.Find(id);
     }
     ViewBag.Type = id;
     ViewBag.Navigation = db.Navigations.ToList();
     ViewBag.Types = types;
     return View();
 }
コード例 #4
0
 public ActionResult TypeDictionaryEdit(int id, TypeDictionary model)
 {
     var TypeDictionary = new TypeDictionary();
     TypeDictionary = db.TypeDictionaries.Find(id);
     TypeDictionary.Belonger = model.Belonger;
     TypeDictionary.TypeValue = model.TypeValue;
     TypeDictionary.FatherID = model.FatherID;
     TypeDictionary.NeedAuthorize = model.NeedAuthorize;
     db.SaveChanges();
     return RedirectToAction("TypeManager");
 }
コード例 #5
0
 public ActionResult AddType(TypeBelonger Belonger, string TypeValue, int NeedAuthorize, int FatherID)
 {
     bool flag = Convert.ToBoolean(NeedAuthorize);
     TypeDictionary type = new TypeDictionary { TypeValue = TypeValue, Belonger = Belonger, NeedAuthorize = flag, FatherID = FatherID, Time = DateTime.Now };
     db.TypeDictionaries.Add(type);
     db.SaveChanges();
     return RedirectToAction("TypeManager");
 }
コード例 #6
0
 public ActionResult AddType(TypeBelonger Belonger, string TypeValue, int NeedAuthorize, int FatherID, int? PID, int Top)
 {
     TypeDictionary temp = db.TypeDictionaries.Where(tp => tp.TypeValue == TypeValue.Trim() && tp.Belonger == Belonger).FirstOrDefault();
     if (temp != null)
     {
         return Redirect("/Admin/AdminMessage?msg=你填写的分类名称已经存在!");
     }
     bool flag = Convert.ToBoolean(NeedAuthorize);
     bool top = Convert.ToBoolean(Top);
     TypeDictionary type = new TypeDictionary { TypeValue = TypeValue, Belonger = Belonger, NeedAuthorize = flag, FatherID = FatherID, Time = DateTime.Now, PID = PID, Top = top };
     db.TypeDictionaries.Add(type);
     db.SaveChanges();
     return Redirect("/Admin/TypeManager?type=" + Belonger);
 }
コード例 #7
0
 public ActionResult TypeDictionaryEdit(int id, TypeDictionary model)
 {
     var TypeDictionary = new TypeDictionary();
     TypeDictionary = db.TypeDictionaries.Find(id);
     TypeDictionary.Belonger = model.Belonger;
     TypeDictionary.TypeValue = model.TypeValue;
     TypeDictionary.FatherID = model.FatherID;
     TypeDictionary.NeedAuthorize = model.NeedAuthorize;
     TypeDictionary.PID = model.PID;
     TypeDictionary.Top = model.Top;
     db.SaveChanges();
     return Redirect("/Admin/TypeManager?type=" + TypeDictionary.Belonger);
 }