/// <summary>
        /// 编辑文件
        /// </summary>
        /// <param name="fileId">文件编号</param>
        /// <param name="fileName">新文件名称</param>
        /// <returns>编辑成功与否</returns>
        public ActionResult EditFile(int fileId, string fileName)
        {
            var file = FileListService.ReadModel(fileId);

            file.FileName = fileName;

            var result = FileListService.UpdateModel(file) ? SuccessTip() : ErrorTip();

            return(Json(result));
        }
        /// <summary>
        /// 新增文件
        /// </summary>
        /// <param name="fileTypeId">文件类型编号</param>
        /// <param name="fileName">文件名称</param>
        /// <returns>新增成功与否</returns>
        public ActionResult InsertFile(int fileTypeId, string fileName)
        {
            var file = new FileList()
            {
                ActiveMark     = true,
                FileName       = fileName,
                RecordFileType = fileTypeId
            };

            var result = FileListService.CreateModel(file) ? SuccessTip() : ErrorTip();

            return(Json(result));
        }
        /// <summary>
        /// 删除文件
        /// </summary>
        /// <param name="fileId">文件编号</param>
        /// <returns>删除成功与否</returns>
        public ActionResult DeleteFile(int fileId)
        {
            var result = FileListService.DeleteModel(fileId) ? SuccessTip() : ErrorTip();

            return(Json(result));
        }
        /// <summary>
        /// 返回文件类型所属的文件
        /// </summary>
        /// <param name="fileTypeId">文件类型编号</param>
        /// <returns>文件类型所属的文件列表</returns>
        public ActionResult ReturnFileTypeOfFile(int fileTypeId)
        {
            var fileList = FileListService.GetFileListByFileTypeId(fileTypeId);

            return(Json(fileList, JsonRequestBehavior.AllowGet));
        }
Beispiel #5
0
 public FileListViewModel()
 {
     _fileListService = new FileListService();
     LoadData();
 }