public ActionResult GetContent(String Id, String fileName) { int id = Convert.ToInt32(Id); File file = FileBLL.GetById(id); if (file != null) { var fileContent = FileContentBLL.GetById(file.FileContentId); Response.ContentType = file.Type; FileResult result = File(fileContent.Data, file.Type, fileName); return(result); } return(RedirectToAction("Index", "Error")); }
public ActionResult Get() { if (Request["Id"] != null && Request["Id"] != "") { int id = Convert.ToInt32(Request["Id"]); File file = FileBLL.GetById(id); ResponseHelper.WriteObject(Response, "File", file); } if (Request["UserId"] != null && Request["UserId"] != "") { int userId = Convert.ToInt32(Request["UserId"]); IList <File> listFile = FileBLL.GetRootByUserId(userId); ResponseHelper.WriteList(Response, "FileList", listFile); } if (Request["FolderId"] != null && Request["FolderId"] != "") { int folderId = Convert.ToInt32(Request["FolderId"]); IList <File> filelst = FileBLL.GetByFolderId(folderId); ResponseHelper.WriteList(Response, "FileList", filelst); } ResponseHelper.WriteNull(Response); return(null); }