Exemplo n.º 1
0
 private void LoadTextVersions(TextDbContext context, TextModuleDbEntity textDbEntity)
 {
     if (textDbEntity != null)
     {
         textDbEntity.TextVersions = context.TextVersions
                                     .Include(y => y.TextLocalisations)
                                     .Where(x => x.TextModuleId == textDbEntity.Id && x.Status != TextVersionStatus.Deleted)
                                     .ToList();
     }
 }
Exemplo n.º 2
0
        private void UpdateTextVersionLocalisations(TextDbContext context, ICollection <TextLocalisation> textVersionLocalisations)
        {
            foreach (var textVersionLocalisation in textVersionLocalisations)
            {
                var textVersionLocalisationDbEntity = context.TextLocalisations
                                                      .FirstOrDefault(x =>
                                                                      x.TextVersionId == textVersionLocalisation.TextVersionId &&
                                                                      x.LanguageId == textVersionLocalisation.LanguageId);

                if (textVersionLocalisationDbEntity == null)
                {
                    context.TextLocalisations.Add(_mapper.Map <TextLocalisationDbEntity>(textVersionLocalisation));
                }
                else
                {
                    textVersionLocalisationDbEntity.Content = textVersionLocalisation.Content;
                }
            }
        }
Exemplo n.º 3
0
        private void UpdateTextVersions(TextDbContext context, IList <TextVersion> textVersions)
        {
            foreach (var textVersion in textVersions)
            {
                var textVersionDbEntity = context.TextVersions.FirstOrDefault(x => x.Id == textVersion.Id);

                if (textVersionDbEntity == null)
                {
                    context.TextVersions.Add(_mapper.Map <TextVersionDbEntity>(textVersion));
                }
                else
                {
                    textVersionDbEntity.Description = textVersion.Description;
                    textVersionDbEntity.Content     = textVersion.Content;
                    textVersionDbEntity.Status      = textVersion.Status;

                    UpdateTextVersionLocalisations(context, textVersion.TextLocalisations);
                }
            }
        }
Exemplo n.º 4
0
 public TextStore(TextDbContext context, ITypeConverter <TextEntity, TextDto> textEntityToTextDtoConverter)
 {
     _context = context;
     _textEntityToTextDtoConverter = textEntityToTextDtoConverter;
 }
Exemplo n.º 5
0
 public TextDbRepository(TextDbContext cntx)
 {
     context = cntx;
 }