public async Task <ConfigGenericItemExtentionValueDto> UpdateConfigGenericItemExtentionValueAsync([FromBody] UpdateConfigGenericItemExtentionValueRequestDto request) { return(await _configGenericItemExtentionValueService.UpdateConfigGenericItemExtentionValueAsync(request, Account?.FullName)); }
public async Task <ConfigGenericItemExtentionValueDto> UpdateConfigGenericItemExtentionValueAsync(UpdateConfigGenericItemExtentionValueRequestDto request, string userName) { _logger.LogDebug($"Update existing config generic item extention value. Request : {JsonConvert.SerializeObject(request)}"); await _updateValidator.ValidateAndThrowAsync(request); var entity = await _dbContext.ConfigGenericItemExtensionValues.SingleOrDefaultAsync(x => x.GroupId == request.GroupId && x.ItemId == request.ItemId && x.ExtentionId == request.ExentionId && x.Id == request.Id); if (entity != null) { _mapper.Map(request, entity); entity.LastUpdatedDate = DateTime.Now; entity.LastUpdatedUserName = userName; _dbContext.Update(entity); await _dbContext.SaveChangesAsync(); return(_mapper.Map <ConfigGenericItemExtentionValueDto>(entity)); } _logger.LogError($"Cannot update generic config item extention value. Request : {JsonConvert.SerializeObject(request)}"); return(null); }