Esempio n. 1
0
        public ActionResult Download(string id)
        {
            var FilesPath = HelpAnswerGroup.GetList().FirstOrDefault(u => u.id == id).Answer;

            if (FilesPath != null)
            {
                JObject jo = (JObject)JsonConvert.DeserializeObject(FilesPath);
                foreach (var path in jo["Values"])
                {
                    ///判断是否为路径格式,如果存在就直接显示下载
                    if (path.ToString().IndexOf("/") > -1)
                    {
                        try
                        {
                            //  var wwwroot = _hostingEnvironment.ContentRootPath + path;
                            //判断该文件是否存在?????
                            //if (System.IO.File.Exists(path.ToString()))
                            //{
                            /// 虚拟文件地址输出下载
                            //}
                            //return Content("<script>alert('该文件已丢失,请重试');window.history.back(-1); </script>");
                            return(File(path.ToString(), "application/vnd.android.package-archive", Path.GetFileName(path.ToString())));
                        }
                        catch (Exception el)
                        {
                            return(Content("<script>alert('文件下载失败,请重试');window.history.back(-1); </script>"));
                        }
                    }
                }
            }
            return(Content("<script>alert('文件下载失败,请重试');window.history.back(-1); </script>"));
        }
Esempio n. 2
0
        public ActionResult Details(string id)
        {
            var entity = HelpAnswerGroup.GetList().FirstOrDefault(u => u.id == id);

            if (entity != null)
            {
                return(View("Details", entity));
            }
            return(RedirectToAction("Exhibition"));
        }
Esempio n. 3
0
        public ActionResult Delete(string id)
        {
            // ???? 所有的Js 都没有弹出
            var entity = HelpAnswerGroup.GetList().FirstOrDefault(u => u.id == id);

            if (entity != null)
            {
                if (HelpAnswerGroup.Delete(id))
                {
                    return(RedirectToAction("Exhibition"));
                }
                return(Content("<script>alert('删除失败 ,请重试');window.history.back(-1); </script>"));
                // 删除信息同时是否删除文件夹???
            }
            else
            {
                return(Content("<script>alert('删除失败,请重试');window.history.back(-1); </script>"));
            }
        }
Esempio n. 4
0
 /// <summary>
 ///  显示数据
 /// </summary>
 /// <returns></returns>
 public ActionResult Exhibition(string fid)
 {
     ViewData["theader"] = HelpTopicgroup.GetList("FromID='" + fid + "'");
     return(View(HelpAnswerGroup.GetList("FromID='" + fid + "'").ToList()));
 }