public static async Task AddAuditedAsync <TEntity>(this BaseDbContext <AuditTrails, ExceptionLogs, UserBlobs> dbContext, TEntity entity, string transactionMessage, string createdBy = null, string controllerName = null, string actionName = null, string remoteIpAddress = null)
            where TEntity : class
        {
            await dbContext.AddAsync(entity);

            await dbContext.AddAsync(entity.CreateAuditTrails(transactionMessage, createdBy, controllerName, actionName, remoteIpAddress));
        }
        public async Task <TModel> AddAsync(TModel modelToAdd)
        {
            var entityToAdd = _iMapper.Map <TEntity>(modelToAdd);
            var result      = await _baseDbContext.AddAsync(entityToAdd);

            return(_iMapper.Map <TModel>(result.Entity));
        }
Example #3
0
 public virtual async Task AddAsync(TEntity entity)
 {
     await _context.AddAsync(entity);
 }
 public static async Task RemoveAuditedAsync <TEntity>(this BaseDbContext <AuditTrails, ExceptionLogs, UserBlobs> dbContext, IEnumerable <TEntity> entities, string transactionMessage, string createdBy = null, string controllerName = null, string actionName = null, string remoteIpAddress = null)
     where TEntity : class
 {
     dbContext.RemoveRange(entities);
     await dbContext.AddAsync(entities.CreateAuditTrails(transactionMessage, createdBy, controllerName, actionName, remoteIpAddress));
 }