public string GetList() { BLL.TeachFilesBLL bll = new BLL.TeachFilesBLL(); DataSet ds = bll.GetAllList(); return(ds.Tables[0].ToJson()); }
public string GetUploadFile(HttpContext context) { HttpPostedFile file = context.Request.Files["fileToUpload"]; if (file != null && string.IsNullOrEmpty(file.FileName) == false) { file.SaveAs(context.Server.MapPath("~/TeachingFileMgr/TeachFiles/") + file.FileName); BLL.TeachFilesBLL bll = new BLL.TeachFilesBLL(); Model.TeachFilesModel mod = new Model.TeachFilesModel(); mod.CreateTime = DateTime.Now; mod.PersonName = context.Session[0].ToString(); mod.FileDesc = context.Request.Form["filedesc"]; mod.FileName = file.FileName; mod.FilePath = "/TeachingFileMgr/TeachFiles/" + file.FileName; bool b = bll.Add(mod); if (b) { return("上传教学文件成功!".ToJson()); } else { return("上传教学文件失败!".ToJson()); } } else { return("请选择文件!".ToJson()); } }