public ActionResult SaveFile() { FileModel file = new FileModel(); string ext = Path.GetExtension(Request.Files[0].FileName); file.PathName = Guid.NewGuid().ToString("N") + ext; Request.Files[0].SaveAs(MTConfig.SaveBasePath + file.PathName); if (!string.IsNullOrEmpty(Request["showName"])) { file.ShowName = Request["showName"] + ext; } else { file.ShowName = Request.Files[0].FileName; } file.CreateTime = DateTime.Now; file.Insert(); return(Json(file)); }
public ActionResult FileEdit(FileModel model) { if (string.IsNullOrEmpty(model.ID)) { ViewData[EditFlag] = true; if (model.Insert() != null) { LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(FileModel)); return(JsonSuccess("")); } return(JsonError("")); } else { ViewData[EditFlag] = true; if (model.Update() > 0) { LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(FileModel)); return(JsonSuccess("")); } return(JsonError("")); } }