/// <summary>
        /// 下载Apk文件
        /// </summary>
        /// <param name="Path"></param>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ActionResult DownApkFile(string Path, int Id)
        {
            IMobileVersionBLL mobileVersionBll = BLLFactory <IMobileVersionBLL> .GetBLL("MobileVersionBLL");

            T_MobileVersion mobileVersion = mobileVersionBll.GetEntity(u => u.Id == Id);

            //获取文件的相对路径
            var path = Server.MapPath(Path);

            //如果客户端信息版本不存在
            if (mobileVersion != null)
            {
                //获取文件名
                var item = mobileVersion.ApkFilePath.Substring(12);

                //如果不包含改路径
                if (!System.IO.File.Exists(path))
                {
                    return(RedirectToAction("MobileVersion", "Error404"));
                }

                return(File(path, "application/octet-stream", item));
            }

            return(RedirectToAction("MobileVersion", "VersionList"));
        }
        public JsonResult AddVersion(MobileVersionModel model)
        {
            JsonModel jm = new JsonModel();

            //如果表单模型验证成功
            if (ModelState.IsValid)
            {
                string apkFilePath = "";
                // 判断apk文件夹是否存在
                if (Directory.Exists(Server.MapPath(ConstantParam.APK_FILE_DIR)) == false)
                {
                    Directory.CreateDirectory(Server.MapPath(ConstantParam.APK_FILE_DIR));
                }

                // 上传单个文件
                if (System.Web.HttpContext.Current.Request.Files.Count > 0)
                {
                    HttpPostedFile PostedFile = System.Web.HttpContext.Current.Request.Files[0];
                    if (PostedFile.ContentLength > 0)
                    {
                        string FileName       = PostedFile.FileName;
                        string strExPrentFile = FileName.Substring(FileName.LastIndexOf(".") + 1);
                        var    formatName     = (model.Type == 0 ? "Owner_" : "Property_") + model.VersionCode;
                        apkFilePath = ConstantParam.APK_FILE_DIR + formatName + "." + strExPrentFile;
                        var path = Server.MapPath(apkFilePath);
                        PostedFile.SaveAs(path);

                        // 保存表单内容
                        IMobileVersionBLL mobileVersionBll = BLLFactory <IMobileVersionBLL> .GetBLL("MobileVersionBLL");

                        T_MobileVersion newVersion = new T_MobileVersion()
                        {
                            VersionCode = model.VersionCode,
                            VersionName = model.VersionName,
                            Type        = model.Type,
                            Desc        = model.Desc,
                            ApkFilePath = apkFilePath
                        };
                        // 保存到数据库
                        mobileVersionBll.Save(newVersion);
                    }
                    else
                    {
                        jm.Msg = "不能上传空文件";
                    }
                    //日志记录
                    jm.Content = "新增移动端版本" + model.VersionName;
                }
            }
            else
            {
                // 保存异常日志
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }

            return(Json(jm, JsonRequestBehavior.AllowGet));
        }