Example #1
0
        public async Task <APIResult> SaveReportAttachment(SaveReportAttachdto param)
        {
            try
            {
                string AttachXml = CommonHelper.Serializer(typeof(List <ReportAttachmentDto>), param.AttachList);
                string spName    = @"up_RMMT_REP_Attachment_C";

                DynamicParameters dp = new DynamicParameters();
                dp.Add("@AttachXml", AttachXml, DbType.Xml);
                dp.Add("@UserId", param.UserId, DbType.Int32);

                using (var conn = new SqlConnection(DapperContext.Current.SqlConnection))
                {
                    conn.Open();
                    using (var tran = conn.BeginTransaction(System.Data.IsolationLevel.ReadCommitted))
                    {
                        await conn.ExecuteAsync(spName, dp, tran, null, CommandType.StoredProcedure);

                        tran.Commit();
                    }
                    return(new APIResult {
                        Body = "", ResultCode = ResultType.Success, Msg = ""
                    });
                }
            }
            catch (Exception ex)
            {
                return(new APIResult {
                    Body = "", ResultCode = ResultType.Failure, Msg = ex.Message
                });
            }
        }
Example #2
0
 public Task <APIResult> SaveReportAttachment([FromBody] SaveReportAttachdto param)
 {
     return(_reportService.SaveReportAttachment(param));
 }