public DownloadAttachmentResponse() { IsSuccessBit = false; LoanId = string.Empty; MediaUrl = string.Empty; DownloadFullPath = string.Empty; Attachment = new Attachment(); FailureResponse = new GenericFailuareResponse(); EncompassDocument = new EncompassDocumentEntity(); }
public async Task <DbResponse <EncompassDocumentEntity> > AddDocumentAsync(EncompassDocumentEntity addingDocument) { var addDocumentDbResponse = new DbResponse <EncompassDocumentEntity>(new EncompassDocumentEntity()) { Body = addingDocument }; try { int newId; using (IDbConnection connection = _dbConnection.CreateStagingConnection()) { var ids = await connection.QueryAsync <int>( "[dbo].[AddDownloadDocument]", new { addingDocument.LoanGuid, addingDocument.DocumentTitle, addingDocument.DocumentTypeName, addingDocument.DocumentDtTm, addingDocument.DocumentGuid, addingDocument.AddedById, addingDocument.AddedByName, addingDocument.FileName, addingDocument.FileSizeBytes, addingDocument.DownloadSucceededBit, addingDocument.DownloadFileFullPath, addingDocument.StartDownloadDtTm, addingDocument.EndDownloadDtTm, addingDocument.IsActiveBit, addingDocument.DownloadStatusTypeId, addingDocument.ErrorMsgTxt }, commandType : CommandType.StoredProcedure).ConfigureAwait(false); newId = ids.FirstOrDefault(); } addDocumentDbResponse.IsSuccessBit = true; addDocumentDbResponse.Body.Id = newId; } catch (Exception ex) { addDocumentDbResponse.IsSuccessBit = false; addDocumentDbResponse.ErrorMsgTxt = JsonConvert.SerializeObject(new { message = JsonConvert.SerializeObject(ex.Message), stackTrace = ex.StackTrace }); } return(addDocumentDbResponse); }
public async Task <DbResponse <EncompassDocumentEntity> > UpdateDocumentAsync(EncompassDocumentEntity updatingDocument) { var updateDocumentDbResponse = new DbResponse <EncompassDocumentEntity>(new EncompassDocumentEntity()) { Body = updatingDocument }; try { using (IDbConnection connection = _dbConnection.CreateStagingConnection()) { var rowAffected = await connection.ExecuteAsync( "[dbo].[UpdateDownloadDocument]", new { updatingDocument.Id, updatingDocument.LoanGuid, updatingDocument.DocumentTitle, updatingDocument.DocumentTypeName, updatingDocument.DocumentDtTm, updatingDocument.DocumentGuid, updatingDocument.AddedById, updatingDocument.AddedByName, updatingDocument.FileName, updatingDocument.FileSizeBytes, updatingDocument.DownloadSucceededBit, updatingDocument.DownloadFileFullPath, updatingDocument.StartDownloadDtTm, updatingDocument.EndDownloadDtTm, updatingDocument.IsActiveBit, updatingDocument.DownloadStatusTypeId, updatingDocument.ErrorMsgTxt }, commandType : CommandType.StoredProcedure).ConfigureAwait(false); } updateDocumentDbResponse.IsSuccessBit = true; } catch (Exception ex) { updateDocumentDbResponse.IsSuccessBit = false; updateDocumentDbResponse.ErrorMsgTxt = JsonConvert.SerializeObject(new { message = JsonConvert.SerializeObject(ex.Message), stackTrace = ex.StackTrace }); } return(updateDocumentDbResponse); }