Example #1
0
        public ActionResult Create(DanhMucKhoaHoc danhMuc)
        {
            try
            {
                // TODO: Add insert logic here
                if (ModelState.IsValid)
                {
                    var danhMucDao = new DanhMucKhoaHocDao();

                    int maHoaDon = danhMucDao.Insert(danhMuc);
                    if (maHoaDon > 0)
                    {
                        return(RedirectToAction("Index", "DanhMucKhoaHoc"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Thêm thất bại");
                    }
                }
                return(View(danhMuc));
            }
            catch
            {
                return(View());
            }
        }
Example #2
0
        public ActionResult TaoMoiVaSuaDanhMuc(DanhMucKhoaHoc danhMuc)
        {
            eCenterDbContext _context = new eCenterDbContext();
            var danhMucDao            = new DanhMucKhoaHocDao();

            int _maDanhMuc = danhMucDao.Insert(danhMuc);

            //var modal = danhMucDao.GetById(_maDanhMuc);

            if (_maDanhMuc > 0)
            {
                return(RedirectToAction("Index", "KhoaHoc"));
            }
            else
            {
                ModelState.AddModelError("", "Thêm thất bại");
            }

            return(View(danhMuc));
        }