Esempio n. 1
0
        private void InsertOrUpdateLabel(Label @new, Label old)
        {
            var entity = _dbContext.Labels
                         .Where(it => it.SiteName == @new.Site.FullName && it.Name == @new.Name && it.Category == (@new.Category ?? ""))
                         .FirstOrDefault();

            if (entity != null)
            {
                entity.Value = @new.Value;
            }
            else
            {
                if (!string.IsNullOrEmpty(@new.Category))
                {
                    AddCategory(@new.Site, @new.Category);
                }
                entity                 = new LabelEntity(@new.Site.FullName, @new.Name, @new.Value, @new.Category);
                entity.UUID            = @new.UUID;
                entity.UtcCreationDate = @new.UtcCreationDate;
                _dbContext.Labels.Add(entity);
            }
            entity.LastestEditor = @new.LastestEditor;
            entity.UtcLastestModificationDate = @new.UtcLastestModificationDate;


            _dbContext.SaveChanges();
        }
Esempio n. 2
0
        private void InsertOrUpdateLabel(Element @new, Element old)
        {
            var entity = _dbContext.Labels
                         .Where(it => it.SiteName == SiteName && it.Name == @new.Name && it.Category == (@new.Category ?? ""))
                         .FirstOrDefault();

            if (entity != null)
            {
                entity.Value = @new.Value;
            }
            else
            {
                if (!string.IsNullOrEmpty(@new.Category))
                {
                    AddCategory(@new.Category, @new.Culture);
                }
                entity = new LabelEntity(SiteName, @new);
                _dbContext.Labels.Add(entity);
            }
            _dbContext.SaveChanges();
        }
Esempio n. 3
0
 private void InsertOrUpdateLabel(Element @new, Element old)
 {
     var entity = _dbContext.Labels
           .Where(it => it.SiteName == SiteName && it.Name == @new.Name && it.Category == (@new.Category ?? ""))
           .FirstOrDefault();
     if (entity != null)
     {
         entity.Value = @new.Value;
     }
     else
     {
         if (!string.IsNullOrEmpty(@new.Category))
         {
             AddCategory(@new.Category, @new.Culture);
         }
         entity = new LabelEntity(SiteName, @new);
         _dbContext.Labels.Add(entity);
     }
     _dbContext.SaveChanges();
 }
Esempio n. 4
0
        private void InsertOrUpdateLabel(Label @new, Label old)
        {
            var entity = _dbContext.Labels
                  .Where(it => it.SiteName == @new.Site.FullName && it.Name == @new.Name && it.Category == (@new.Category ?? ""))
                  .FirstOrDefault();
            if (entity != null)
            {
                entity.Value = @new.Value;
            }
            else
            {
                if (!string.IsNullOrEmpty(@new.Category))
                {
                    AddCategory(@new.Site, @new.Category);
                }
                entity = new LabelEntity(@new.Site.FullName, @new.Name, @new.Value, @new.Category);
                entity.UUID = @new.UUID;
                entity.UtcCreationDate = @new.UtcCreationDate;
                _dbContext.Labels.Add(entity);
            }
            entity.LastestEditor = @new.LastestEditor;
            entity.UtcLastestModificationDate = @new.UtcLastestModificationDate;

            _dbContext.SaveChanges();
        }