Esempio n. 1
0
        public void Localize(Models.HtmlBlock o, Models.Site targetSite)
        {
            var htmlBlock = Get(o);
            var entity    = new HtmlBlockEntity(htmlBlock);

            entity.SiteName = targetSite.FullName;

            _dbContext.HtmlBlocks.Add(entity);
            _dbContext.SaveChanges();
        }
Esempio n. 2
0
        private void InsertOrUpdate(Models.HtmlBlock @new, Models.HtmlBlock old)
        {
            var entity = _dbContext.HtmlBlocks
                         .Where(it => it.SiteName == @new.Site.FullName && it.Name == @new.Name)
                         .FirstOrDefault();

            if (entity != null)
            {
                entity.Body = @new.Body;
            }
            else
            {
                entity = new HtmlBlockEntity(@new);
                _dbContext.HtmlBlocks.Add(entity);
            }
            _dbContext.SaveChanges();
        }
 private void InsertOrUpdate(Models.HtmlBlock @new, Models.HtmlBlock old)
 {
     var entity = _dbContext.HtmlBlocks
           .Where(it => it.SiteName == @new.Site.FullName && it.Name == @new.Name)
           .FirstOrDefault();
     if (entity != null)
     {
         entity.Body = @new.Body;
     }
     else
     {
         entity = new HtmlBlockEntity(@new);
         _dbContext.HtmlBlocks.Add(entity);
     }
     _dbContext.SaveChanges();
 }
        public void Localize(Models.HtmlBlock o, Models.Site targetSite)
        {
            var htmlBlock = Get(o);
            var entity = new HtmlBlockEntity(htmlBlock);
            entity.SiteName = targetSite.FullName;

            _dbContext.HtmlBlocks.Add(entity);
            _dbContext.SaveChanges();
        }