public async Task <int> AddLikeHistoryAsync(HistoryEntity data, Guid userId) { data.UserGuid = userId; var result = _context.AddAsync(data); var affected = await _context.SaveChangesAsync(); if (affected == 0) { throw new InvalidOperationException("Could not create History."); } return(result.Id); }