コード例 #1
0
        public ActionResult GetDtIdById(int id)
        {
            InsertViewCount(id);
            GetUserByideaId(id);
            string path = new IdeaDao().GetFileSP(id);

            if (path != null)
            {
                string fileName = path.Substring(path.LastIndexOf('/') + 1);
                ViewBag.FileNameSP = fileName;
            }
            ViewBag.ViewIdea = new IdeaDao().GetIdeaByIdSt(id);
            return(View());
        }
コード例 #2
0
        public FileContentResult DownloadFile(int ideaId)
        {
            string path     = new IdeaDao().GetFileSP(ideaId / 777);
            string fileName = path.Substring(path.LastIndexOf('/') + 1);

            if (((UserLogin)(Session[ModelPr.CommonClass.CommonCls.User_session])).UserID != 0)
            {
                string basePath  = AppDomain.CurrentDomain.BaseDirectory + "Data/StudentData/";
                byte[] fileBytes = System.IO.File.ReadAllBytes(basePath + fileName);
                return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName));
            }
            else
            {
                return(null);
            }
        }