Exemple #1
0
        /// <summary>
        /// 选中 点击的课程,会显示已完成选中
        /// </summary>
        /// <returns></returns>
        public ActionResult StudentCoursesSelect(int id)
        {
            Stu_Course sc = new Stu_Course {
                CourseId = id, StudentId = new Guid(studentId)
            };

            mHelp.Add <Stu_Course>(sc);
            Course course = db.Course.Where(c => c.Id == id).FirstOrDefault();

            course.RealAttend++;
            db.SaveChanges();
            return(RedirectToAction("CourseIndex"));
        }
Exemple #2
0
        public ActionResult AddGroup(FormCollection form)
        {
            StudentInfo      sInfo = db.StudentInfo.Where(s => s.Id == studentId).FirstOrDefault();
            CourseGroupTitle Cgt   = new CourseGroupTitle();

            Cgt.CourseGroupCreatId     = sInfo.Id;
            Cgt.CourseGroupCreatAcount = sInfo.Account;
            Cgt.CourseGroupCreatName   = form["Title"];
            Cgt.Content   = form["Content"];
            Cgt.CourseId  = Convert.ToInt32(form["teacher"]);
            Cgt.CreatTime = DateTime.Now.ToLongDateString() + DateTime.Now.ToShortTimeString();
            mHelp.Add <CourseGroupTitle>(Cgt);
            return(RedirectToAction("GroupIndex"));
        }
        public ActionResult AddReply(FormCollection form)
        {
            Admin        aInfo    = db.Admin.Where(s => s.Id == adminId).FirstOrDefault();
            int          id       = Convert.ToInt32(form["GroupID"]);
            TitleContent tContent = new TitleContent()
            {
                Content            = form["Content"],
                CourseGroupTitleId = id,
                FromId             = aInfo.Id,
                FromName           = aInfo.UserName,
                FromAccount        = aInfo.Account,
                FromDate           = DateTime.Now.ToLongDateString() + DateTime.Now.ToShortTimeString()
            };

            ModelHelpers mHelp = new ModelHelpers();

            try
            {
                mHelp.Add <TitleContent>(tContent);
            }
            catch (Exception)
            {
                TempData["msg"] = "回复失败";
                return(RedirectToAction("GroupDetail", new { id = id }));
            }

            return(RedirectToAction("GroupDetail", new { id = id }));
        }
        public ActionResult AddReply(FormCollection form)
        {
            Admin aInfo = db.Admin.Where(s => s.Id == adminId).FirstOrDefault();
            int id = Convert.ToInt32(form["GroupID"]);
            TitleContent tContent = new TitleContent()
            {
                Content = form["Content"],
                CourseGroupTitleId = id,
                FromId = aInfo.Id,
                FromName = aInfo.UserName,
                FromAccount = aInfo.Account,
                FromDate = DateTime.Now.ToLongDateString()+DateTime.Now.ToShortTimeString()
            };

            ModelHelpers mHelp = new ModelHelpers();

            try
            {
                mHelp.Add<TitleContent>(tContent);
            }
            catch (Exception)
            {
                TempData["msg"] = "回复失败";
                return RedirectToAction("GroupDetail", new { id = id });
            }

            return RedirectToAction("GroupDetail", new { id = id });
        }
Exemple #5
0
        public ActionResult AddNewBlog(FormCollection form)
        {
            StudentInfo sInfo = db.StudentInfo.Where(s => s.Id == studentId).FirstOrDefault();
            BlogTitle   bt    = new BlogTitle
            {
                CreatId      = studentId,
                CreatAccount = sInfo.Account,
                TitleName    = form["TitleName"],
                CourseId     = Convert.ToInt32(form["teacher"]),
                BlogContent  = form["BlogContent"],
                CreatTime    = DateTime.Now.ToLongDateString() + DateTime.Now.ToShortTimeString(),
                ReadTimes    = 0
            };

            mHelp.Add <BlogTitle>(bt);
            return(RedirectToAction("ShowAllBolgList"));
        }
Exemple #6
0
 public ActionResult Register(StudentInfo userModel)
 {
     userModel.Authority = "0";
     ModelHelpers mHelp = new ModelHelpers();
     mHelp.Add<StudentInfo>(userModel);
     CourseCenter.Common.TakeCookie.SetCookie("userId", userModel.Id.ToString());
     return RedirectToAction("StudentIndex", "Home");
 }
 public ActionResult AddNewCourse(Course course)
 {
     string teacherId = TakeCookie.GetCookie("userId");
     course.CourseStatus = 0;
     course.TeacherId = new Guid(teacherId);
     ModelHelpers mHelp = new ModelHelpers();
     mHelp.Add<Course>(course);
     return RedirectToAction("CoursesDetail", new { id = course.Id });
 }
Exemple #8
0
        public ActionResult Register(StudentInfo userModel)
        {
            userModel.Authority = "0";
            ModelHelpers mHelp = new ModelHelpers();

            mHelp.Add <StudentInfo>(userModel);
            CourseCenter.Common.TakeCookie.SetCookie("userId", userModel.Id.ToString());
            return(RedirectToAction("StudentIndex", "Home"));
        }
Exemple #9
0
 public ActionResult ApplyTable(Tb_ApplyTable ApplyTable)
 {
     ApplyTable.RecordTime = DateTime.Today;
     ApplyTable.UserID     = int.Parse(TakeCookie.GetCookie("userId"));
     ApplyTable.IsPass     = 0;
     //ModelState.IsValid用于
     if (ModelState.IsValid)
     {
         if (mHelp.Add <Tb_ApplyTable>(ApplyTable) > 0)
         {
             Session["ApplyID"] = ApplyTable.ApplyID;
             return(RedirectToAction("SoftList", new { id = ApplyTable.ApplyID }));
         }
         else
         {
             return(View());
         }
     }
     return(View("index"));
 }
        public ActionResult AddNewCourse(Course course)
        {
            string teacherId = TakeCookie.GetCookie("userId");

            course.CourseStatus = 0;
            course.TeacherId    = new Guid(teacherId);
            ModelHelpers mHelp = new ModelHelpers();

            mHelp.Add <Course>(course);
            return(RedirectToAction("CoursesDetail", new { id = course.Id }));
        }
 public ActionResult AddComment(FormCollection form)
 {
     try
     {
         db.StudentInfo.Where(s => s.Id == userId).FirstOrDefault();
         BlogReply br = new BlogReply
         {
             BlogId       = Convert.ToInt32(form["BlogID"]),
             ReplyId      = userId,
             ReplyAccount = db.StudentInfo.Where(s => s.Id == userId).FirstOrDefault().Account,
             ReplyContent = form["Content"],
             CreatTime    = DateTime.Now.ToLongDateString() + DateTime.Now.ToShortTimeString()
         };
         mHelp.Add <BlogReply>(br);
         return(RedirectToAction("StudentGetBlogDetail", new { id = br.BlogId }));
     }
     catch (Exception)
     {
         return(RedirectToAction("StudentGetBlogDetail", new { id = Convert.ToInt32(form["BlogID"]) }));
     }
 }
        public ActionResult ReplyQusetion(FormCollection form)
        {
            Question que = new Question();
            Guid     id  = new Guid(TakeCookie.GetCookie("userid"));

            que.Title   = form["Title"];
            que.Content = form["Content"];
            string[] accountAndId = form["hiddenIA"].Split('#');
            que.ToId        = new Guid(accountAndId[1]);
            que.ToAcconut   = accountAndId[0];
            que.FromId      = id;
            que.FromAccount = accountAndId[2];
            que.Flag        = "未读";
            que.CreateTime  = DateTime.Now.ToShortDateString();

            mHelp.Add <Question>(que);
            return(RedirectToAction("QusetionCenter"));
        }
        public ActionResult AddComment(FormCollection form)
        {
            Guid teacherId = new Guid(TakeCookie.GetCookie("userId"));

            try
            {
                db.TeacherInfo.Where(s => s.Id == teacherId).FirstOrDefault();
                BlogReply br = new BlogReply
                {
                    BlogId       = Convert.ToInt32(form["BlogID"]),
                    ReplyId      = teacherId,
                    ReplyAccount = db.TeacherInfo.Where(s => s.Id == teacherId).FirstOrDefault().Account,
                    ReplyContent = form["Content"],
                    CreatTime    = DateTime.Now.ToLongDateString() + DateTime.Now.ToShortTimeString()
                };

                modelHelp.Add <BlogReply>(br);
                return(RedirectToAction("TeacherGetBlogDetail", "LoadMore", new { id = br.BlogId }));
            }
            catch (Exception)
            {
                return(RedirectToAction("TeacherGetBlogDetail", "LoadMore", new { id = Convert.ToInt32(form["BlogID"]) }));
            }
        }