Пример #1
0
        // GET: Student
        public ActionResult Index(bool status = false)
        {
            ViewBag.status = status;
            var lis = new StudentBCL().GetAll().Where(q => q.Status == status);

            return(View(lis));
        }
        public ActionResult Create(Guid?coursesId)
        {
            List <StudentObjects> LisStudent = new StudentBCL().GetAllNOTCLASS();

            /*FeaIdObject objFeat = LisFeat.Single(x => x.FeaId.Equals(0));
             * LisFeat.Remove(objFeat);*/
            ViewBag.ALl = new CoursesBCL().GetAll();
            if (coursesId != null)
            {
                var name = new CoursesBCL().GetByCoId((Guid)coursesId);
                ViewBag.Name = name;
            }
            ViewBag.ListStudent = LisStudent;
            ViewBag.coursesId   = coursesId;
            List <CoursesObjects> lisCourses = new CoursesBCL().GetAll();

            /* AccountObject objAccount = lisFeat.Single(x => x.FeaId.Equals(0));
             * lisFeat.Remove(objFeat);*/
            ViewBag.ListCourses = lisCourses;
            StudentDetailtObjects ob = new StudentDetailtObjects()
            {
                CoId = coursesId
            };

            return(View(ob));
        }
        public ActionResult Create(StudentDetailtObjects obj, int IsOption = 0)
        {
            var oke = !new StudentDetailtBCL().GetJoin().Any(q => q.CoId == obj.CoId && q.StudetId == obj.StudetId);

            if (oke)
            {
                obj.StdId = Guid.NewGuid();
                if (new StudentDetailtBCL().Insert(obj))
                {
                    if (IsOption == 0)
                    {
                        return(RedirectToAction("Index", "StudentDetail"));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Courses"));
                    }
                }

                else
                {
                    ModelState.AddModelError("", "Thêm học viên thất bại!");
                }
            }
            else
            {
                List <StudentObjects> LisStudent = new StudentBCL().GetAll();
                ViewBag.ListStudent = LisStudent;
                ModelState.AddModelError("", "Học viên này đã học ở lớp này!");
            }
            return(View());
        }
        public ActionResult ChiTiet(Guid?ID = null)
        {
            if (!ID.HasValue)
            {
                return(RedirectToAction("Index"));
            }
            var data = new StudentBCL().GetByStudetId(ID.Value);

            ViewBag.ChiTietDanhSach = "Học viên " + data.FullName;
            ViewBag.status          = data.Status;
            ViewBag.start           = "";
            ViewBag.end             = "";
            return(View("Index", new StudentDetailtBCL().GetJoin().Where(q => q.StudentJoin.StudetId == ID.Value)));
        }
Пример #5
0
        public ActionResult Edit(StudentObjects objS)
        {
            objS.Deleted = false;
            if (!String.IsNullOrEmpty(objS.Email))
            {
                objS.Email = new SecurityConexts().EncryptInfo(objS.Email);
            }
            if (!String.IsNullOrEmpty(objS.Mobile))
            {
                objS.Mobile = new SecurityConexts().EncryptInfo(objS.Mobile);
            }
            var b = new StudentBCL().Update(objS);

            if (b)
            {
                return(RedirectToAction("Index", "Student"));
            }
            else
            {
                ModelState.AddModelError("", "Edit that bai");
            }

            return(View());
        }
Пример #6
0
        public ActionResult Edit(Guid id)
        {
            var obj = new StudentBCL().GetByStudetId(id);

            return(View(obj));
        }