.NET Core Audit Returns same Old and New values while Database Update and store in JsonData while using Dapper

184 Views Asked by At

I am facing a problem while returning the Audit Data Old and New value are same. Here is the Code which I am using for Updating my Database. Please help to understand what is going wrong here.

Please find the Code here

 using (AuditScope.Create("Role:Create", () => roleEntity))
                    {


                        param.Add("@VAR_MODE_V", DBStoredProcedure.OperationMode.INSERT);
                        param.Add("@Rol_ID_N", roleEntity.Rol_ID_N, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
                        var result = await this._adlerMDBContext.QueryAsync<AdlerSPResponseMessage>(DBStoredProcedure.Role.SPName, AddUserResolverParam(param), commandType: CommandType.StoredProcedure);
                        var roleId = param.Get<dynamic>("@Rol_ID_N");

                        if (result?.FirstOrDefault()?.Status == false)
                        {
                            AdlERMLogError($"{errorPrefix}/{nameof(AddAsync)} Exception - {FormatErrorMessage(result)}", null);
                          
                        }

                        return new AdlerResponse<int,long>()
                        {
                            Code = Convert.ToInt32(result?.FirstOrDefault()?.Code),
                            Status = result?.FirstOrDefault()?.Status,
                            Severity = MessageSeverity((int)result?.FirstOrDefault()?.Code),
                            Data = result?.FirstOrDefault()?.TotalRows ?? 0,
                            DataId = roleId,
                            Messages = GetResponseMessages(result),
                            Rows = result?.FirstOrDefault()?.TotalRows ?? 0
                        };
                    }
                                

                                        
0

There are 0 best solutions below