public bool Create(ThongTinDaoTaoBoiDuongEntity _ThongTinDaoTaoBoiDuongEntity)
        {
            try
            {
                var ThongTinDaoTaoBoiDuong = new ThongTinDaoTaoBoiDuongs
                {
                    Id = _ThongTinDaoTaoBoiDuongEntity.Id,
                    TenTruong = _ThongTinDaoTaoBoiDuongEntity.TenTruong,
                    NganhHoc_LopHoc = _ThongTinDaoTaoBoiDuongEntity.NganhHoc_LopHoc,
                    ThoiGianTu = _ThongTinDaoTaoBoiDuongEntity.ThoiGianTu,
                    ThoiGianDen = _ThongTinDaoTaoBoiDuongEntity.ThoiGianDen,
                    HinhThucHoc = _ThongTinDaoTaoBoiDuongEntity.HinhThucHoc,
                    VanBang_ChungChi_TrinhDo = _ThongTinDaoTaoBoiDuongEntity.VanBang_ChungChi_TrinhDo,
                    ThongTinDaoTaoBoiDuong_ThongTin2C = _ThongTinDaoTaoBoiDuongEntity.ThongTinDaoTaoBoiDuong_ThongTin2C
                };

                m_UnitOfWork.ThongTinDaoTaoBoiDuongRepository.Insert(ThongTinDaoTaoBoiDuong);
                m_UnitOfWork.Save();
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
        /// only return json to client
        public ActionResult Create(ThongTinDaoTaoBoiDuongEntity thongTinDaoTaoBoiDuong)
        {
            ThongTinDaoTaoBoiDuongServices service = new ThongTinDaoTaoBoiDuongServices();

            if (thongTinDaoTaoBoiDuong == null)
            {
                RenderResult.RequestError(ViewData, "Lỗi đối số không hợp lệ");
                return Json(JsonConvert.SerializeObject(ViewData));
            }

            if (service.Create(thongTinDaoTaoBoiDuong))
            {
                return Json(RenderResult.RequestCompleted(ViewData, "Thêm thông tin đào tạo bồi dưỡng thành công"));
            }
            else
            {

                return Json(RenderResult.RequestCompleted(ViewData, "Lỗi khi thêm thông tin đào tạo bồi dưỡng"));
            }
        }
        public List<ThongTinDaoTaoBoiDuongEntity> GetAll()
        {
            IEnumerable<ThongTinDaoTaoBoiDuongs> model = this.m_UnitOfWork.ThongTinDaoTaoBoiDuongRepository.GetAll();
            List<ThongTinDaoTaoBoiDuongEntity> result = new List<ThongTinDaoTaoBoiDuongEntity>();

            foreach (var item in model)
            {
                ThongTinDaoTaoBoiDuongEntity thongTinDaoTaoBoiDuong = new ThongTinDaoTaoBoiDuongEntity
                {
                    Id = item.Id,
                    HinhThucHoc = item.HinhThucHoc,
                    NganhHoc_LopHoc = item.NganhHoc_LopHoc,
                    TenTruong = item.TenTruong,
                    ThoiGianDen = item.ThoiGianDen,
                    ThoiGianTu = item.ThoiGianTu,
                    ThongTinDaoTaoBoiDuong_ThongTin2C = item.ThongTinDaoTaoBoiDuong_ThongTin2C,
                    VanBang_ChungChi_TrinhDo = item.VanBang_ChungChi_TrinhDo,
                };
                result.Add(thongTinDaoTaoBoiDuong);
            }

            return result;
        }
        /// only return json to client
        public ActionResult Edit(ThongTinDaoTaoBoiDuongEntity thongTinDaoTaoBoiDuong)
        {
            ThongTinDaoTaoBoiDuongServices service = new ThongTinDaoTaoBoiDuongServices();

            if (thongTinDaoTaoBoiDuong == null)
            {
                return Json(RenderResult.RequestError(ViewData, "Lỗi đối số không hợp lệ"), JsonRequestBehavior.AllowGet);
            }

            try
            {
                if (service.Update(thongTinDaoTaoBoiDuong))
                    return Json(RenderResult.RequestCompleted(ViewData, "Chỉnh sửa thành công"));

                return Json(RenderResult.RequestCompleted(ViewData, "Chỉnh sửa không thành công"));
            }
            catch(Exception e)
            {
                System.Console.WriteLine(e.ToString());

                return Json(RenderResult.RequestError(ViewData, "Lỗi xảy ra"));
            }
        }
 public bool Delete(ThongTinDaoTaoBoiDuongEntity thongTinDaoTaoBoiDuong)
 {
     try
     {
         var ThongTinDaoTaoBoiDuong = m_UnitOfWork.ThongTinDaoTaoBoiDuongRepository.GetByID(thongTinDaoTaoBoiDuong.Id);
         if (ThongTinDaoTaoBoiDuong != null)
         {
             m_UnitOfWork.ThongTinDaoTaoBoiDuongRepository.Delete(thongTinDaoTaoBoiDuong.Id);
             m_UnitOfWork.Save();
         }
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
 public bool Update(ThongTinDaoTaoBoiDuongEntity _ThongTinDaoTaoBoiDuongEntity)
 {
     try
     {
         var ThongTinDaoTaoBoiDuong = m_UnitOfWork.ThongTinDaoTaoBoiDuongRepository.GetByID(_ThongTinDaoTaoBoiDuongEntity.Id);
         if (ThongTinDaoTaoBoiDuong != null)
         {
             ThongTinDaoTaoBoiDuong.TenTruong = _ThongTinDaoTaoBoiDuongEntity.TenTruong;
             ThongTinDaoTaoBoiDuong.NganhHoc_LopHoc = _ThongTinDaoTaoBoiDuongEntity.NganhHoc_LopHoc;
             ThongTinDaoTaoBoiDuong.ThoiGianTu = _ThongTinDaoTaoBoiDuongEntity.ThoiGianTu;
             ThongTinDaoTaoBoiDuong.ThoiGianDen = _ThongTinDaoTaoBoiDuongEntity.ThoiGianDen;
             ThongTinDaoTaoBoiDuong.HinhThucHoc = _ThongTinDaoTaoBoiDuongEntity.HinhThucHoc;
             ThongTinDaoTaoBoiDuong.VanBang_ChungChi_TrinhDo = _ThongTinDaoTaoBoiDuongEntity.VanBang_ChungChi_TrinhDo;
             ThongTinDaoTaoBoiDuong.ThongTinDaoTaoBoiDuong_ThongTin2C = _ThongTinDaoTaoBoiDuongEntity.ThongTinDaoTaoBoiDuong_ThongTin2C;
             m_UnitOfWork.ThongTinDaoTaoBoiDuongRepository.Update(ThongTinDaoTaoBoiDuong);
             m_UnitOfWork.Save();
         }
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
 public void Update(int _Id, ThongTinDaoTaoBoiDuongEntity _ThongTinDaoTaoBoiDuongEntity)
 {
     var ThongTinDaoTaoBoiDuong = m_UnitOfWork.ThongTinDaoTaoBoiDuongRepository.GetByID(_Id);
     if (ThongTinDaoTaoBoiDuong != null)
     {
         ThongTinDaoTaoBoiDuong.TenTruong = _ThongTinDaoTaoBoiDuongEntity.TenTruong;
         ThongTinDaoTaoBoiDuong.NganhHoc_LopHoc = _ThongTinDaoTaoBoiDuongEntity.NganhHoc_LopHoc;
         ThongTinDaoTaoBoiDuong.ThoiGianTu = _ThongTinDaoTaoBoiDuongEntity.ThoiGianTu;
         ThongTinDaoTaoBoiDuong.ThoiGianDen = _ThongTinDaoTaoBoiDuongEntity.ThoiGianDen;
         ThongTinDaoTaoBoiDuong.HinhThucHoc = _ThongTinDaoTaoBoiDuongEntity.HinhThucHoc;
         ThongTinDaoTaoBoiDuong.VanBang_ChungChi_TrinhDo = _ThongTinDaoTaoBoiDuongEntity.VanBang_ChungChi_TrinhDo;
         ThongTinDaoTaoBoiDuong.ThongTinDaoTaoBoiDuong_ThongTin2C = _ThongTinDaoTaoBoiDuongEntity.ThongTinDaoTaoBoiDuong_ThongTin2C;
         m_UnitOfWork.ThongTinDaoTaoBoiDuongRepository.Update(ThongTinDaoTaoBoiDuong);
         m_UnitOfWork.Save();
     }
 }
        public ActionResult Delete(ThongTinDaoTaoBoiDuongEntity thongTinDaoTaoBoiDuong)
        {
            ThongTinDaoTaoBoiDuongServices service = new ThongTinDaoTaoBoiDuongServices();

            try
            {
                if (service.Delete(thongTinDaoTaoBoiDuong))
                    return Json(RenderResult.RequestCompleted(ViewData, "Xóa thành công"));

                return Json(RenderResult.RequestCompleted(ViewData, "Xóa không thành công"));
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e.ToString());
                return Json(RenderResult.RequestError(ViewData, "Lỗi xảy ra"));
            }

        }