public BasicResult DeleteFile(Guid id) { var req = new GenOneReqInParm <Guid>() { Parm_01 = id }; using (TphMtcFileContext context = new TphMtcFileContext(DbName.TPH_MTC_F)) { var result = BeginService <GenOneReqInParm <Guid>, BaseReqResult>(req, context); try { result = GetAction <IDeleteMtcFile>().Execute(result.RetCode, req); result = CommonFinally(result); } catch (Exception ex) { Rollback(result, ex); } return(new BasicResult() { Code = result.RetCode.ReturnCode, Message = result.RetCode.MessageText }); } }
/// <summary> /// 上傳檔案至TPH_MTC_F /// </summary> /// <param name="file">檔案資訊</param> /// <returns>stream_id</returns> public Result <string> UploadFile(IFileReqInParm file) { //Parm_01 -> 存放的目錄 var req = new GenTwoReqInParm <string, IFileReqInParm>() { Parm_01 = "API", Parm_02 = file }; using (TphMtcFileContext context = new TphMtcFileContext(DbName.TPH_MTC_F)) { var result = BeginService <GenTwoReqInParm <string, IFileReqInParm>, GenOneStringReqResult>(req, context); try { result = GetAction <IUploadMtcFile>().Execute(result.RetCode, req); result = CommonFinally(result); return(new Result <string>() { Code = result.RetCode.ReturnCode, Message = result.RetCode.MessageText, Data = result.Text }); } catch (Exception ex) { Rollback(result, ex); return(new Result <string>() { Code = result.RetCode.ReturnCode, Message = result.RetCode.MessageText, Data = null }); } } }