public JsonResult Create(ArticleFolder model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string uploadPath = base.CurrentLoginUser().UserFolderPath + "\\Article\\" + model.DisplayName;

                    if (Directory.Exists(uploadPath))
                        return Json(new { result = false, text = "Folder is exist!", callbackapi = " " });

                    Directory.CreateDirectory(uploadPath);
                    //model.RecordUser = base.CurrentLoginUser().UserName;
                    model.Path = "Article\\" + model.DisplayName;
                   // model.RecordDate = DateTime.Now;
                    bool jsonResult = this.superService.Insert<ArticleFolder>(model);
                    BootstrapMvc2015GitHub.Framework.Log.Instance.RecordActionLog(new System.Diagnostics.StackFrame(0).GetMethod().Name, this.ServiceKey, "Media", jsonResult);
                    return Json(new
                    {
                        result = jsonResult,
                        text = jsonResult ? "One record created successfully!" : "something was wrong!",
                        callbackapi = "Media/Article"
                    });
                }
                catch (Exception ex)
                {
                    BootstrapMvc2015GitHub.Framework.Log.Instance.RecordActionLog(new System.Diagnostics.StackFrame(0).GetMethod().Name, this.ServiceKey, "Media", false, ex.Message);
                    throw ex;
                }
            }
            else
                throw new Exception("ModelState.IsValid is false");
        }
        public JsonResult Update(ArticleFolder model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string json = this.superService.FindOneById<ArticleFolder>(model.Id);
                    ArticleFolder record = JsonConvert.DeserializeObject<ArticleFolder>(json);// SuperManager.Instance.FindOneById<Album>(model.Id);
                    Dictionary<string, object> updates = new Dictionary<string, object>() { { "ArticleType", model.ArticleType }, { "DisplayName", model.DisplayName } };
                    //   if (!record.DisplayName.Equals(model.DisplayName) && Directory.Exists(base.CurrentLoginUser().UserFolderPath + record.Path.Replace(record.DisplayName, model.DisplayName)))
                    //   return Json(new { result = false, text = "Folder is exist!", callbackapi = " " });

                    bool jsonResult = this.superService.UpdateFields<ArticleFolder>(updates, new QueryModel("id", model.Id)); // SuperManager.Instance.UpdateById<Article>(update);
                    //if (jsonResult && !record.DisplayName.Equals(model.DisplayName))
                    //{
                    //    string path = base.CurrentLoginUser().UserFolderPath + record.Path;
                    //    RobinCore.Instance.ModifyDirectoryName(path, record.DisplayName, model.DisplayName);
                    //}
                    BootstrapMvc2015GitHub.Framework.Log.Instance.RecordActionLog(new System.Diagnostics.StackFrame(0).GetMethod().Name, this.ServiceKey, "Media", jsonResult);
                    return Json(new
                    {
                        result = jsonResult,
                        text = jsonResult ? "record  updated successfully!" : "something was wrong!",
                        callbackapi = "Media/Article"
                    });
                }
                catch (Exception ex)
                {
                    BootstrapMvc2015GitHub.Framework.Log.Instance.RecordActionLog(new System.Diagnostics.StackFrame(0).GetMethod().Name, this.ServiceKey, "Media", false, ex.Message);
                    throw ex;
                }
            }
            else
                throw new Exception("ModelState.IsValid is false");
        }
        public Task<bool> RunS(ArticleFolder articleFolder)
        {
            return Task.Run(() =>
            {
                #region tongbu
                string basePath = DataCache.Instance.LoginUser.UserFolderPath + articleFolder.Path;
                string baseUrlPath = DataCache.Instance.LoginUser.UserFolderUrlPath + articleFolder.Path;
                //get files in folder
                DirectoryInfo dir = new DirectoryInfo(basePath);
                if (!Directory.Exists(basePath))
                    Directory.CreateDirectory(basePath);
                List<FileInfo> files = dir.GetFiles().ToList<FileInfo>();
                //get data in datatable
                QueryModel query = new QueryModel("UploadUserName", DataCache.Instance.LoginUser.UserName);
                query.AddAndQuery(new QueryInfo("FolderId", "=", articleFolder.Id));
                string json = UnityInstance.Instance.GetObject<ISuperService>().FindList<Article>(query);
                List<Article> articles = JsonConvert.DeserializeObject<List<Article>>(json);//

                foreach (FileInfo file in files)
                {
                    Article data = articles.FirstOrDefault(item => item.FileName.Equals(file.Name));
                    if (data == null)
                    {
                        Article record = new Article()
                        {
                            FileName = file.Name,
                            FolderId = articleFolder.Id,
                            CreationTime = file.LastWriteTime,
                            CurrentIndex = 0,
                            Evaluation = Convert.ToInt32(EvaluationType.一般),
                            FileExtention = file.Extension.ToLower(),
                            FilePath = "User\\" + DataCache.Instance.LoginUser.UserName + "\\" + articleFolder.Path + "\\" + file.Name,
                            FileUrlPath = articleFolder.Path + "\\" + file.Name,
                            FileSize = file.Length,
                            UploadDate = DateTime.Now,
                            UploadUserDisplayName = DataCache.Instance.LoginUser.UserDisplayName,
                            UploadUserName = DataCache.Instance.LoginUser.UserName,
                            LastAccessTime = file.LastAccessTime
                        };
                        UnityInstance.Instance.GetObject<ISuperService>().Insert<Article>(record);// SuperManager.Instance.Create<Article>(record);
                    }
                    else
                    {
                        articles.Remove(data);
                    }
                }
                List<string> toDelete = new List<string>();
                foreach (Article item in articles)
                {
                    toDelete.Add(item.Id);
                }
                UnityInstance.Instance.GetObject<ISuperService>().DeleteByIds<Article>(String.Join(",", toDelete));
                #endregion

                return true;
            });
        }