Пример #1
0
        protected bool InitPositions(SioCmsContext context, IDbContextTransaction transaction)
        {
            bool isSucceed = true;
            var  count     = context.SioPortalPage.Count();

            if (count == 0)
            {
                var p = new SioPosition()
                {
                    Description = nameof(SioEnums.CatePosition.Nav)
                };
                context.Entry(p).State = EntityState.Added;
                p = new SioPosition()
                {
                    Description = nameof(SioEnums.CatePosition.Top)
                };
                context.Entry(p).State = EntityState.Added;
                p = new SioPosition()
                {
                    Description = nameof(SioEnums.CatePosition.Left)
                };
                context.Entry(p).State = EntityState.Added;
                p = new SioPosition()
                {
                    Description = nameof(SioEnums.CatePosition.Footer)
                };
                context.Entry(p).State = EntityState.Added;

                context.SaveChanges();
            }
            return(isSucceed);
        }
Пример #2
0
        protected bool InitCultures(InitCulture culture, SioCmsContext context, IDbContextTransaction transaction)
        {
            bool isSucceed = true;

            try
            {
                if (context.SioCulture.Count() == 0)
                {
                    // EN-US

                    var enCulture = new SioCulture()
                    {
                        Specificulture = culture.Specificulture,
                        FullName       = culture.FullName,
                        Description    = culture.Description,
                        Icon           = culture.Icon,
                        Alias          = culture.Alias,
                        Status         = (int)SioEnums.SioContentStatus.Published
                    };
                    context.Entry(enCulture).State = EntityState.Added;

                    context.SaveChanges();
                }
            }
            catch
            {
                isSucceed = false;
            }
            return(isSucceed);
        }