Example #1
0
        /// <summary>
        /// 上传管理页面
        /// </summary>
        /// <param name="id">页面索引</param>
        /// <returns>操作后的结果</returns>
        public ActionResult List(Int32 id = 1)
        {
            PagedList <FileInfo> list = UploadsManager.AdminGetUploadFiles(id);

            ViewBag.RootPath = ConfigurationManager.UploadDirectoryUrl;

            return(ViewWithPager(list, id));
        }
        public ActionResult UploadsEdit(UploadModel model)
        {
            UploadsManager manager = new UploadsManager();

            SaveResult result = manager.SaveImage(model);

            if (result.State == SaveResultState.Success)
            {
                return(RedirectToAction("UploadsList"));
            }

            return(View(model));
        }
Example #3
0
        public ActionResult New(HttpPostedFileBase file)
        {
            return(ResultToMessagePage(() =>
            {
                IMethodResult result = UploadsManager.AdminSaveUploadFile(file);

                if (!result.IsSuccess)
                {
                    return new Tuple <IMethodResult, String>(result, String.Empty);
                }

                String fileUrl = UploadsManager.AdminPreviewUploadFileUrl(result.ResultObject.ToString());
                String successInfo = String.Format("Your have uploaded file successfully!<br/>Your file url:<a href=\"{0}\" target=\"_blank\">{0}</a>", fileUrl);

                return new Tuple <IMethodResult, String>(result, successInfo);
            }));
        }
Example #4
0
 public UploadsController(UploadsManager uploadsManager)
 {
     _UploadsManager = uploadsManager;
 }
        public ActionResult UploadsEdit(int?id = null)
        {
            UploadsManager manager = new UploadsManager();

            return(View(manager.GetUploadModel(id)));
        }