public ActionResult ModifyTrain(培训资料 model) { try { 培训资料 model1 = 培训资料管理.查找培训资料(model.Id); List<string> pathname = new List<string>(); if (model1.内容主体.附件 != null && model1.内容主体.附件.Count() != 0) { pathname = model1.内容主体.附件; } string[] path = Request.Form["path"].ToString().Split('|'); for (int i = 0; i < path.Length - 1; i++) { if (System.IO.File.Exists(Server.MapPath(@path[i]))) { pathname.Add(path[i]); } } if (model.内容主体.发布时间 == default(DateTime)) { model.内容主体.发布时间 = DateTime.Now; } model.内容主体.附件 = pathname; 培训资料管理.更新培训资料(model); return Content("<script>alert('修改成功!');window.location='/单位用户后台/TrainingList';</script>"); } catch { return Redirect("/单位用户后台/TrainingList"); } }
public ActionResult AddTrain(培训资料 model) { //string content = Request.Form["content"].ToString(); //model.内容主体.内容=content; try { List<string> pathname = new List<string>(); string[] path = Request.Form["path"].ToString().Split('|'); for (int i = 0; i < path.Length - 1; i++) { if (System.IO.File.Exists(Server.MapPath(@path[i]))) { pathname.Add(path[i]); } } if (model.内容主体.发布时间 == default(DateTime)) { model.内容主体.发布时间 = DateTime.Now; } model.内容主体.附件 = pathname; 培训资料管理.添加培训资料(model); return Content("<script>if(confirm('成功添加培训资料,点击确定继续添加,点击取消进入查看')){window.location='/单位用户后台/TrainingAdd';}else{window.location='/单位用户后台/TrainingList';}</script>"); } catch { return Redirect("/单位用户后台/TrainingAdd"); } }
public static bool 添加培训资料(培训资料 content) { return Mongo.添加(content); }
public ActionResult TrainingAdd() { 培训资料 model = new 培训资料(); return View(model); }
public static bool 更新培训资料(培训资料 content) { return Mongo.更新(content); }