public static FunctionLogDetails UpdateFunctionLogRequest(FunctionLogDetails functionLogDetails, FunctionStatus status, string message = null) { if (functionLogDetails != null) { functionLogDetails.Status = status; functionLogDetails.EndDate = DateTime.UtcNow; functionLogDetails.Message = message; } return(functionLogDetails); }
public async Task <bool> CreateFunctionLog(FunctionLogDetails model) { if (model != null) { var entityModel = _mapper.Map <FunctionLog>(model); var isSuccess = await _functionLogRepository.CreateAsync(entityModel) > 0; if (isSuccess) { model.Id = entityModel.Id; return(true); } } return(false); }
public override void Given() { CreateMapper(); CommonServiceLogger = new Logger <CommonService>(new NullLoggerFactory()); TlLookupRepositoryLogger = new Logger <GenericRepository <TlLookup> >(new NullLoggerFactory()); TlLookupRepository = new GenericRepository <TlLookup>(TlLookupRepositoryLogger, DbContext); FunctionLogRepositoryLogger = new Logger <GenericRepository <FunctionLog> >(new NullLoggerFactory()); FunctionLogRepository = new GenericRepository <FunctionLog>(FunctionLogRepositoryLogger, DbContext); CommonRepository = new CommonRepository(DbContext); CommonService = new CommonService(CommonServiceLogger, CommonMapper, TlLookupRepository, FunctionLogRepository, CommonRepository); _functionLog = new FunctionLogDetails { Name = "Test", StartDate = DateTime.UtcNow, Status = FunctionStatus.Processing, PerformedBy = "Test User" }; }
public async Task <bool> UpdateFunctionLog(FunctionLogDetails model) { if (model != null) { var functionLogEntity = await _functionLogRepository.GetFirstOrDefaultAsync(x => x.Id == model.Id); if (functionLogEntity == null) { _logger.LogWarning(LogEvent.NoDataFound, $"FunctionLog record not found for Id = {model.Id} and FunctionName = {model.Name}. Method: UpdateFunctionLog()"); return(false); } functionLogEntity.Status = model.Status; functionLogEntity.EndDate = model.EndDate; functionLogEntity.Message = model.Message; functionLogEntity.ModifiedOn = DateTime.UtcNow; functionLogEntity.ModifiedBy = model.PerformedBy; return(await _functionLogRepository.UpdateAsync(functionLogEntity) > 0); } return(false); }