Ejemplo n.º 1
0
        public ActionResult EditImage(BaiHoc lbh, HttpPostedFileBase uploadEditorImage)
        {
            if (uploadEditorImage != null)
            {
                lbh.UrlHinh = "/Content/Image/" + uploadEditorImage.FileName;
                GetPathImage(uploadEditorImage);
            }
            lbh.ModifiedBy   = GetUser().UserName;
            lbh.ModifiedDate = DateTime.Now;
            var list = new Model.BaiHocDAO();
            var lbh1 = list.SelectWhere("ID ==" + lbh.ID).FirstOrDefault();

            if (ModelState.IsValid)
            {
                if (list.Update(lbh, lbh1))
                {
                    return(RedirectToAction("index"));
                }
                else
                {
                    ModelState.AddModelError("", "Không thể thực hiệ");
                }
            }
            return(View("Edit"));
        }
Ejemplo n.º 2
0
        public IEnumerable <Model.EF.BaiHoc> GetListPageLessionType(int page, int pageSize, int id)
        {
            //int nSkip = (page - 1) * pageSize;
            List <LoaiBaiHoc> lsLBH = new LoaiBaiHocDAO().SelectAll();
            List <BaiHoc>     lsBH  = new BaiHocDAO().SelectAll();
            var list = lsBH.Where(x => x.IDLoaiBaiHoc == id).ToList();

            return(list.OrderByDescending(x => x.ID).ToPagedList(page, pageSize));
        }
Ejemplo n.º 3
0
        public IEnumerable <Model.EF.BaiHoc> GetListPageLession(int page, int pageSize, int id)
        {
            //int nSkip = (page - 1) * pageSize;
            List <LoaiBaiHoc> lsLBH = new LoaiBaiHocDAO().SelectAll();
            List <BaiHoc>     lsBH  = new BaiHocDAO().SelectAll();

            var list = lsBH.Join(lsLBH, x => x.IDLoaiBaiHoc, y => y.ID, (x, y) => new { lsbh = x, lslbh = y }).Where(a => a.lslbh.IDCha == id).Select(c => c.lsbh).ToList();

            return(list.OrderByDescending(x => x.ID).ToPagedList(page, pageSize));
        }