public IEnumerable <PersonalisationTag> GetTags() { try { var context = GetContext(); if (context == null) { return(null); } if (context.Tags?.Any() ?? false) { return(context.Tags); } if (context.HasStoreTags) { return(null); } PersonalisationDto entity = _personalisationStore.GetById(context.MemberId); UpsertContext(entity?.Tags); context.HasStoreTags = true; return(entity?.Tags); } catch (Exception ex) { _logger.Error(typeof(PersonalisationService), ex); return(null); } }
public void Upsert(PersonalisationDto dto) { try { using (var scope = _scopeProvider.CreateScope(autoComplete: true)) { scope.Database.Save(new PersonalisationTagStoreSchema { MemberId = dto.MemberId, Tags = dto.Tags?.Select(x => new PersonalisationTagSchema { Tag = x.Tag, Score = x.Score })?.ToList(), Updated = DateTime.UtcNow }); } } catch (Exception ex) { _logger.Error(typeof(PersonalisationStore), ex); throw; } }