public ActionResult Edit(int id) { var material = jlService.GetMaterial(id); var model = new MaterialModel(); model.Description = material.Description; model.FileName = material.FileName; model.Picture = material.Picture; model.Status = material.Status == 0; model.Title = material.Title; model.FileType = material.MaterialType; material.AddTime = model.AddTime ?? DateTime.Now; return(View(model)); }
public ActionResult Download(int id) { if (id > 0) { var material = jlService.GetMaterial(id); if (material != null) { // 下载量加1 jlService.IncrementPageViews(id); var filePath = Server.MapPath(material.FileName); var mime = MimeMapping.GetMimeMapping(filePath); var bytes = GetFile(filePath); return(File(bytes, mime)); } } return(HttpNotFound()); }