public ActionResult UploadFileTaiLieu(int id, HttpPostedFileBase fileTaiLieu)
 {
     using (var kHKTKhoaHocKiThuatRepository = new KHKTKhoaHocKiThuatService())
     {
         try
         {
             if (fileTaiLieu.ContentLength > 0)
             {
                 //string filename = Path.GetFileName(fileTaiLieu.FileName);
                 KhoaHocKiThuat khoaHocKiThuat = kHKTKhoaHocKiThuatRepository.GetKhoaHocKiThuatById(id);
                 if (khoaHocKiThuat == null)
                 {
                     return(Json("failed"));
                 }
                 string filename = String.Format("{0:00}", khoaHocKiThuat.LinhVucId) + '-' + khoaHocKiThuat.Id.ToString() + Path.GetExtension(fileTaiLieu.FileName);
                 string _path    = Path.Combine(Server.MapPath("~/UploadedFiles/KhoaHocKiThuat"), filename);
                 fileTaiLieu.SaveAs(_path);
                 kHKTKhoaHocKiThuatRepository.UpdateFileTaiLieuKhoaHocKiThuat(id, filename.Trim());
                 return(Json(new ReturnFormat(200, "success", null), JsonRequestBehavior.AllowGet));
             }
             else
             {
                 kHKTKhoaHocKiThuatRepository.DeleteKHKTById(id);
                 return(Json("failed"));
             }
         }
         catch
         {
             kHKTKhoaHocKiThuatRepository.DeleteKHKTById(id);
             return(Json("failed"));
         }
     }
 }
 public ActionResult DeleteKHKTById(int id)
 {
     using (var kHKTKhoaHocKiThuatRepository = new KHKTKhoaHocKiThuatService())
     {
         bool deleted = kHKTKhoaHocKiThuatRepository.DeleteKHKTById(id);
         if (deleted == true)
         {
             return(Json(new ReturnFormat(200, "success", null), JsonRequestBehavior.AllowGet));
         }
         return(Json(new ReturnFormat(400, "failed", null), JsonRequestBehavior.AllowGet));
     }
 }