Exemplo n.º 1
0
        /// <summary>
        ///  Restore a document from the trash folder to its original location
        /// </summary>
        /// <param name="id">Document Id</param>
        public void RestoreDocument(string id)
        {
            using (var db = new ConnectDbContext(_db))
            {
                //get all folderitems for document. should be 2 items: one doc that is deleted (IsDeleted == true) and
                //another document that is in the trash folder.
                var documentItems = db.FolderItems.Include(x => x.Folder).Where(x => x.DocumentId == id).ToList();

                var ownerId = documentItems.First().Folder.OwnerId;

                //Get trash folder for library
                var trashFolder = GetTrashFolder(ownerId);

                foreach (var docItem in documentItems)
                {
                    //if this is the doc in trash folder, then remove it
                    if (docItem.Folder.Id == trashFolder.Id)
                    {
                        db.FolderItems.Remove(docItem);
                        db.SaveChanges();
                    }
                    else
                    {
                        //if this the document Item not in the trash folder and the IsDeleted is true, then just update the flag
                        if (docItem.IsDeleted && docItem.Folder.Id != trashFolder.Id)
                        {
                            docItem.IsDeleted = false;
                            db.FolderItems.Update(docItem);
                            db.SaveChanges();
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private IEnumerable <Page> CreateSitePagesV0(Site site, IEnumerable <PageMaster> masterPages)
        {
            var    sitePages  = new List <Page>();
            string dataFolder = null;
            IList <SiteTemplatePage> pagesToSeed = null;

            // Setting pages & data path either from template (if supplied) or using defaults
            if (_siteTemplate.Pages != null)
            {
                pagesToSeed = _siteTemplate.Pages;
                dataFolder  = _coreOptions.FileSystemRoot + "\\" + _siteTemplate.DataFolder;
            }
            else
            {
                dataFolder  = _defaultDataFolder;
                pagesToSeed = GetDefaultPagesToSeed();
            }

            // Create Pages
            foreach (var seedInfo in pagesToSeed)
            {
                var master    = masterPages.First(x => x.TemplateId == seedInfo.Template);
                var seedFiles = seedInfo.SeedData?.Select(file => dataFolder + "\\" + file);

                var sitePage = new Page
                {
                    Id           = KeyGen.NewGuid(),
                    SiteId       = site.Id,
                    PageMasterId = master.Id,
                    Title        = seedInfo.Title,
                    Path         = seedInfo.Path,
                    Type         = PageType.Normal,
                    IsHomePage   = seedInfo.Path == "/"
                };

                _connectDb.Pages.Add(sitePage);
                _connectDb.SaveChanges();

                var version = _pageManager.CreateInitialVersion(sitePage, seedFiles).Result;

                // manually seed if no seed files were included
                if (seedFiles == null)
                {
                    if (_pageTemplates[0].Id == master.TemplateId)
                    {
                        ManuallySeedHomePage(sitePage, version);
                    }
                    else
                    {
                        ManuallySeedSecondaryPage(sitePage, version);
                    }
                }

                sitePages.Add(sitePage);
            }

            return(sitePages);
        }
Exemplo n.º 3
0
        public void SaveModel(TModel model)
        {
            model.Id = Guid.NewGuid().ToString("N");

            _db.Add(new JsonWidget
            {
                Id        = model.Id,
                ModelType = model.GetType().FullName,
                ModelJson = JsonConvert.SerializeObject(model)
            });

            _db.SaveChanges();
        }
Exemplo n.º 4
0
        /// <summary>
        ///  Ensure a document library exist or it will  create a new one based on type and owner
        /// </summary>
        /// <param name="ownerId"></param>
        /// <param name="libraryType"></param>
        /// <param name="location"></param>
        /// <returns>DocumentLibrary</returns>
        public async Task <DocumentLibrary> CreateDocumentLibrary(string ownerId, string libraryType, string location)
        {
            Ensure.NotNullOrEmpty(ownerId);
            Ensure.NotNullOrEmpty(libraryType);
            Ensure.NotNullOrEmpty(location);

            DocumentLibrary documentLibrary = null;

            using (var db = new ConnectDbContext(_db))
            {
                documentLibrary = db.DocumentLibraries.FirstOrDefault(x => x.OwnerId == ownerId && x.LibraryType == libraryType);
                if (documentLibrary == null)
                {
                    documentLibrary = new DocumentLibrary
                    {
                        Id          = Guid.NewGuid().ToString("N"),
                        OwnerId     = ownerId,
                        LibraryType = libraryType,
                        Location    = location
                    };

                    db.DocumentLibraries.Add(documentLibrary);
                    db.SaveChanges();
                }
            }

            //Ensure there is a Trash folder and Root folder
            await EnsureTrashFolderAsync(ownerId);

            return(documentLibrary);
        }
Exemplo n.º 5
0
        public async Task AddDocumentAsync(TDocument document, IFolder folder)
        {
            Ensure.NotNull(document, $"{nameof(document)} cannot be null.");
            Ensure.NotNull(folder, $"{nameof(folder)} cannot be null.");

            var item = await GetItemAsync(document.DocumentId, folder.Id);

            if (item == null)
            {
                using (var db = new ConnectDbContext(_db))
                {
                    item = new FolderItem()
                    {
                        AllowComments   = true,
                        DocumentId      = document.DocumentId,
                        Folder          = folder as Folder,
                        FolderId        = folder.Id,
                        Id              = KeyGen.NewGuid(),
                        InheritSecurity = false,
                        InheritSharing  = false,
                        InheritTags     = false,
                        ItemStatus      = ModerationStatus.Approved
                    };

                    // No async, since we are in a lock
                    db.Entry(item).State = EntityState.Added;

                    await db.FolderItems.AddAsync(item);

                    db.SaveChanges();
                }
            }
        }
Exemplo n.º 6
0
        public async Task DeleteDocumentAsync(string documentId)
        {
            Ensure.NotNull(documentId, $"{nameof(documentId)} cannot be null.");

            using (var db = new ConnectDbContext(_db))
            {
                //Get document objects
                var documentItem = db.FolderItems.Include(x => x.Folder).FirstOrDefault(x => x.DocumentId == documentId);
                var document     = await _documentService.GetAsync(documentId);

                var ownerId = documentItem.Folder.OwnerId;

                if (documentItem == null)
                {           // TODO Log information?
                    return; // Document is already there (potential race condition, so no error)
                }

                //make a copy in trash for displaying purposes
                var trashFolder = GetTrashFolder(ownerId);
                var clone       = new FolderItem
                {
                    Id              = Guid.NewGuid().ToString("N"),
                    DocumentId      = documentItem.DocumentId,
                    FolderId        = trashFolder.Id,
                    CreatedBy       = documentItem.CreatedBy,
                    InheritSecurity = documentItem.InheritSecurity,
                    InheritSharing  = documentItem.InheritSharing,
                    InheritTags     = documentItem.InheritTags,
                    ItemStatus      = documentItem.ItemStatus,
                    AllowComments   = documentItem.AllowComments,
                    IsDeleted       = false
                };
                db.FolderItems.Add(clone);
                db.SaveChanges();


                //set original document to deleted (soft delete)
                documentItem.IsDeleted = true;

                db.FolderItems.Update(documentItem);
                db.SaveChanges();
            }
        }
Exemplo n.º 7
0
        public async Task <bool> AddSiteDomainAsync(string siteId, string domainKey, bool isDefault)
        {
            Ensure.NotNull(siteId);
            Ensure.NotNull(domainKey);

            var client = await GetClientAsync(siteId);

            var domainExists = await DomainExistsAsync(domainKey);

            if (domainExists)
            {
                return(false);
            }
            else
            {
                //If IsDefault True, then clear any other default domains
                //as this domain will be the default
                var defaultDomain = await GetDefaultDomainAsync(siteId);

                if (defaultDomain != null)
                {
                    defaultDomain.IsDefault = false;
                    _db.SiteDomains.Update(defaultDomain);
                    _db.SaveChanges();
                }


                // Save the site domain
                var siteDomain = new SiteDomain()
                {
                    SiteId    = siteId,
                    DomainKey = NormalizeDomain(domainKey),
                    IsDefault = isDefault
                };

                _db.SiteDomains.Add(siteDomain);
                await _db.SaveChangesAsync();


                // Register OIDC Redirect Uris
                await _oidcTenantManager.AddUriAsync(
                    client.TenantKey,
                    siteDomain.ToSignInRedirectUri(),
                    Identity.Models.TenantUriType.OidcSignin
                    );

                await _oidcTenantManager.AddUriAsync(
                    client.TenantKey,
                    siteDomain.ToPostLogoutRedirectUri(),
                    Identity.Models.TenantUriType.OidcPostLogout
                    );

                return(true);
            }
        }
Exemplo n.º 8
0
        public async Task <IFolder> UpdateFolderAsync(IFolder folder)
        {
            Ensure.NotNull(folder, $"{nameof(folder)} cannot be null.");

            using (var db = new ConnectDbContext(_db))
            {
                db.Folders.Update(folder.ToFolder());
                db.SaveChanges();
                return(await db.Folders.SingleOrDefaultAsync(x => x.Id == folder.Id) ?? folder);
            }
        }
Exemplo n.º 9
0
        private async Task <IFolder> CreateFolderInternalAsync(IFolder folder, bool ensureRoot)
        {
            var ownerId = folder.OwnerId;

            await EnsureFolderQuotaAsync(ownerId);

            Folder result;

            var parentId = folder.ParentId ?? string.Empty;

            if (ensureRoot)
            {
                await EnsureRootFolderAsync(ownerId);
            }

            bool   exists;
            Folder parentFolder;

            using (var db = new ConnectDbContext(_db))
            {
                // NOTE: Doing context calls rather than method calls to avoid including ChildFolders
                parentFolder = string.IsNullOrEmpty(parentId)
                    ? await db.Folders.SingleOrDefaultAsync(x => x.DocumentType == typeof(TDocument).FullName && x.OwnerId == ownerId && string.IsNullOrEmpty(x.ParentId))  // NOTE: If the new folder's parent is null, it MUST go in that folder type's root folder. If it was null, then it would be a root, but there can only be 1 root per type
                    : await db.Folders.SingleOrDefaultAsync(x => x.Id == parentId);

                exists = db.Folders.Any(x =>
                                        x.DocumentType == _documentType &&
                                        x.OwnerId == ownerId &&
                                        (x.ParentId ?? string.Empty) == parentId &&
                                        string.Equals(x.Title, folder.Title, StringComparison.CurrentCultureIgnoreCase)
                                        );

                if (exists) // TODO: Fix potential race condition
                {
                    throw new InvalidOperationException(parentId == null
                            ? $"A folder named '{folder.Title}' in root already exists."
                            : $"A folder named '{folder.Title}' in parent folder {parentId} already exists.");
                }
                else
                {
                    result              = folder.ToFolder();
                    result.Id           = KeyGen.NewGuid();
                    result.ParentFolder = parentFolder;
                    result.ParentId     = parentFolder?.Id;
                    result.DocumentType = _documentType;

                    db.Folders.Add(result);
                    db.SaveChanges();
                }
            }

            return(result);
        }
Exemplo n.º 10
0
        public async Task <FileDocument> UpdateAsync(FileDocument document)
        {
            using (var db = new ConnectDbContext(_writeDb))
            {
                db.Attach(document);
                db.Entry(document).State = EntityState.Modified;

                db.SaveChanges();
            }

            return(document);
        }
Exemplo n.º 11
0
        public virtual async Task <FileDocument> CreateAsync(FileDocument document)
        {
            //  await EnsureDocumentQuotaAsync(document);

            // Create database entry
            using (var db = new ConnectDbContext(_writeDb))
            {
                db.FileDocuments.Add(document);
                db.SaveChanges();
            }

            return(document);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Restore a deleted Folder
        /// </summary>
        /// <param name="id"></param>
        public async Task RestoreFolder(string id)
        {
            using (var db = new ConnectDbContext(_db))
            {
                var deletedFolder = db.Folders.FirstOrDefault(x => x.Id == id);

                if (deletedFolder != null)
                {
                    deletedFolder.IsDeleted = false;
                    db.Folders.Update(deletedFolder);
                    db.SaveChanges();
                }
            }
        }
Exemplo n.º 13
0
        public void Delete(string id)
        {
            Ensure.NotNullOrEmpty(id);

            var alert = _db.SiteAlerts.FirstOrDefault(x => x.Id == id);

            if (alert != null)
            {
                _contentManager.DeleteAllVersions(CONTENT_TYPE_SITEALERTS, alert.Id).Wait();
                _contentManager.DeleteAllContentTrees(CONTENT_TYPE_SITEALERTS, alert.Id).Wait();

                _db.Remove(alert);
                _db.SaveChanges();
            }
        }
Exemplo n.º 14
0
        public async Task RemoveFolderAsync(IFolder folder)
        {
            Ensure.NotNull(folder, $"{folder} cannot be null.");

            if (folder.IsSystemFolder)
            {
                throw new InvalidOperationException("Unable to delete system folders.");
            }

            using (var db = new ConnectDbContext(_db))
            {
                var dbFolder = db.Folders.Single(x => x.Id == folder.Id);
                db.Folders.Remove(dbFolder);
                db.SaveChanges();
            }
        }
Exemplo n.º 15
0
        public async Task RemoveDocumentAsync(TDocument document, IFolder folder)
        {
            Ensure.NotNull(document, $"{nameof(document)} cannot be null.");
            Ensure.NotNull(folder, $"{nameof(folder)} cannot be null.");

            var item = await GetItemAsync(document.DocumentId, folder.Id);

            if (item == null)
            {           // TODO Log information?
                return; // Document is already there (potential race condition, so no error)
            }

            using (var db = new ConnectDbContext(_db))
            {
                db.FolderItems.Remove(item);
                db.SaveChanges();
            }
        }
Exemplo n.º 16
0
        public async Task MoveFolderAsync(IFolder folder, IFolder destination)
        {
            // NOT WORKING YET (Requires Federation to work) Ensure.NotNullOrEmpty(ownerId, $"{ownerId} cannot be null or empty.");
            Ensure.NotNull(folder, $"{folder} cannot be null.");
            Ensure.NotNull(destination, $"{destination} cannot be null.");

            if (await IsSystemFolderAsync(folder))
            {
                throw new InvalidOperationException("Unable to move system folders.");
            }
            else
            {
                EnsureNotAncestor(folder, destination);

                using (var db = new ConnectDbContext(_db))
                {
                    var folderEntity = db.Folders.FirstOrDefault(x => x.Id == folder.Id);

                    folderEntity.ParentId = destination.Id;
                    db.Folders.Update(folderEntity);
                    db.SaveChanges();
                }
            }
        }
 protected override void Setup()
 {
     SeedData.CompanyData.Initialize(ConnectDbContext);
     ConnectDbContext.SaveChanges();
 }
Exemplo n.º 18
0
 public virtual T Put(T entity)
 {
     Context.Update(entity, Validator);
     Context.SaveChanges();
     return(entity);
 }
Exemplo n.º 19
0
        private void SeedHomePage(string homePageId)
        {
            // init version & content tree
            var publishedVersion = new ContentVersion
            {
                ContentId    = homePageId,
                ContentType  = HtmlDbSeedConstants.ContentType_SitePage,
                VersionLabel = "Master Page Content Added",
                UserId       = "admin",
                Status       = ContentStatus.Published,
            };

            var contentTree = new ContentTree(publishedVersion);

            _dbContext.ContentVersions.Add(publishedVersion);
            _dbContext.ContentTrees.Add(contentTree);


            // styles
            var topImageStyle = new ContentStyle
            {
                FullWidth       = true,
                BackgroundClass = SiteTemplateConstants.Backgrounds.Default,
            };

            var topGridStyle = new ContentStyle
            {
                BackgroundClass = SiteTemplateConstants.Backgrounds.Default,
                PaddingTop      = SiteTemplateConstants.RootContentPaddingTop,
                PaddingBottom   = SiteTemplateConstants.RootContentPaddingBottom
            };

            var heroUnitStyle = new ContentStyle
            {
                BackgroundClass = SiteTemplateConstants.Backgrounds.Fancy,
                PaddingTop      = SiteTemplateConstants.RootContentPaddingTop,
                PaddingBottom   = SiteTemplateConstants.RootContentPaddingBottom
            };

            var bottomGridStyle = new ContentStyle
            {
                BackgroundClass = SiteTemplateConstants.Backgrounds.Contrast,
                PaddingTop      = SiteTemplateConstants.RootContentPaddingTop,
                PaddingBottom   = SiteTemplateConstants.RootContentPaddingBottom
            };


            // content nodes
            var homePageContentNodes = new ContentNode[]
            {
                // full width zone with image
                new ContentNode(topImageStyle)
                {
                    Id            = Guid.NewGuid().ToString(),
                    ContentTreeId = contentTree.Id,
                    Zone          = "body",
                    Index         = 0,
                    WidgetId      = HtmlDbSeedConstants.WidgetId_Image_GuidanceImageMain,
                    WidgetType    = "image",
                    ViewId        = "image-fitted",
                    Locked        = false,
                },

                // Hero Unit
                new ContentNode(heroUnitStyle)
                {
                    Id            = Guid.NewGuid().ToString(),
                    ContentTreeId = contentTree.Id,
                    ParentId      = null,
                    Zone          = "body",
                    Index         = 1,
                    WidgetId      = null,
                    WidgetType    = "zone",
                    ViewId        = "zone-1",
                    Locked        = false,

                    ChildNodes = new ContentNode[]
                    {
                        new ContentNode
                        {
                            Id            = Guid.NewGuid().ToString(),
                            ContentTreeId = contentTree.Id,
                            Zone          = "cell-1",
                            Index         = 1,
                            WidgetId      = HtmlDbSeedConstants.WidgetId_Hero_GuidanceWelcome,
                            WidgetType    = "hero",
                            ViewId        = "hero-hero1",
                            Locked        = false,
                        }
                    }
                },

                // 4 images in a grid
                new ContentNode(topGridStyle)
                {
                    Id            = Guid.NewGuid().ToString(),
                    ContentTreeId = contentTree.Id,
                    ParentId      = null,
                    Zone          = "body",
                    Index         = 2,
                    WidgetId      = null,
                    WidgetType    = "zone",
                    ViewId        = "zone-3",
                    Locked        = false,

                    ChildNodes = new ContentNode[]
                    {
                        new ContentNode
                        {
                            Id            = Guid.NewGuid().ToString(),
                            ContentTreeId = contentTree.Id,
                            Zone          = "cell-1",
                            Index         = 0,
                            WidgetId      = HtmlDbSeedConstants.WidgetId_Image_GuidanceImage1,
                            WidgetType    = "image",
                            ViewId        = "image-fitted",
                            Locked        = false
                        },
                        new ContentNode
                        {
                            Id            = Guid.NewGuid().ToString(),
                            ContentTreeId = contentTree.Id,
                            Zone          = "cell-2",
                            Index         = 1,
                            WidgetId      = HtmlDbSeedConstants.WidgetId_Image_GuidanceImage2,
                            WidgetType    = "image",
                            ViewId        = "image-fitted",
                            Locked        = false
                        },
                        new ContentNode
                        {
                            Id            = Guid.NewGuid().ToString(),
                            ContentTreeId = contentTree.Id,
                            Zone          = "cell-3",
                            Index         = 2,
                            WidgetId      = HtmlDbSeedConstants.WidgetId_Image_GuidanceImage3,
                            WidgetType    = "image",
                            ViewId        = "image-fitted",
                            Locked        = false
                        }
                    }
                },
            };


            _dbContext.ContentNodes.AddRange(homePageContentNodes);
            _dbContext.SaveChanges();
        }
Exemplo n.º 20
0
 /// <summary>
 /// Used to initialize dummy table data if no rows present in database.
 /// </summary>
 /// <param name="connectDbContext"></param>
 public static void Initialize(ConnectDbContext connectDbContext)
 {
     CompanyData.Initialize(connectDbContext);
     connectDbContext.SaveChanges();
 }
Exemplo n.º 21
0
        public void Invoke()
        {
            if (_dbContext.JsonWidgets.Count() == 0)
            {
                #region Titles

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Title
                {
                    Id   = HtmlDbSeedConstants.WidgetId_Title_DemoTitle1,
                    Text = "Demo Site"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Title
                {
                    Id   = HtmlDbSeedConstants.WidgetId_Title_DemoTitle2,
                    Text = "Site Title"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Title
                {
                    Id   = HtmlDbSeedConstants.WidgetId_Title_SchoolTitle,
                    Text = "School Name"
                }
                        )
                    );

                #endregion

                #region Alerts

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Alert
                {
                    Id    = HtmlDbSeedConstants.WidgetId_Alert_DemoAlert,
                    Style = "alert-info",
                    Text  = "This alert needs your attention, it's an important sample alert."
                }
                        )
                    );

                #endregion

                #region Images

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_Google,
                    Caption = "Google",
                    Src     = "/img/SeedImages/Google.png"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_DemoLogo1,
                    Caption = "Demo Logo",
                    Src     = "/img/SeedImages/SisLogo.png",
                    Height  = "130px",
                    Width   = "130px"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_DemoLogo2,
                    Caption = "Demo Logo",
                    Src     = "/img/SeedImages/Joomlahunt.png",
                    Height  = "130px",
                    Width   = "100px"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_SchoolLogo,
                    Caption = "School Logo",
                    Src     = "/img/SeedImages/HillsboroHelmet.png",
                    Height  = "130px",
                    Width   = "130px"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_DemoImage1,
                    Caption = "Demo Image 1",
                    Src     = "/img/SeedImages/technics1_400_200.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_DemoImage2,
                    Caption = "Demo Image 2",
                    Src     = "/img/SeedImages/technics4_400_200.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_DemoImage3,
                    Caption = "Demo Image 3",
                    Src     = "/img/SeedImages/technics5_400_200.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_DemoImageA,
                    Caption = "Demo Image A",
                    Src     = "/img/SeedImages/sports1_400_200.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_DemoImageB,
                    Caption = "Demo Image B",
                    Src     = "/img/SeedImages/sports2_400_200.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_DemoImageC,
                    Caption = "Demo Image C",
                    Src     = "/img/SeedImages/sports3_400_200.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_DemoImageD,
                    Caption = "Demo Image D",
                    Src     = "/img/SeedImages/people1_400_200.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_DemoImageE,
                    Caption = "Demo Image E",
                    Src     = "/img/SeedImages/people2_400_200.jpg"
                }
                        )
                    );


                // inspriration site images
                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_InspirationImageMain,
                    Caption = "School Main Image",
                    Src     = "/templates/inspiration/images/slideshow1.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_InspirationImage1,
                    Caption = "School Image 1",
                    Src     = "/templates/inspiration/images/1.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_InspirationImage2,
                    Caption = "School Image 2",
                    Src     = "/templates/inspiration/images/2.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_InspirationImage3,
                    Caption = "School Image 3",
                    Src     = "/templates/inspiration/images/3.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_InspirationImage4,
                    Caption = "School Image 4",
                    Src     = "/templates/inspiration/images/4.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_InspirationImage5,
                    Caption = "School Round Image 1",
                    Src     = "/templates/inspiration/images/button1.png"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_InspirationImage6,
                    Caption = "School Round Image 2",
                    Src     = "/templates/inspiration/images/button2.png"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_InspirationImage7,
                    Caption = "School Round Image 3",
                    Src     = "/templates/inspiration/images/button3.png"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_InspirationImage8,
                    Caption = "School Round Image 4",
                    Src     = "/templates/inspiration/images/button4.png"
                }
                        )
                    );


                // guidance site images
                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_GuidanceImageMain,
                    Caption = "School Main Image",
                    Src     = "/templates/guidance/images/home-main.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_GuidanceImage1,
                    Caption = "School Image 1",
                    Src     = "/templates/guidance/images/home-1.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_GuidanceImage2,
                    Caption = "School Image 2",
                    Src     = "/templates/guidance/images/home-2.jpg"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.Image
                {
                    Id      = HtmlDbSeedConstants.WidgetId_Image_GuidanceImage3,
                    Caption = "School Image 3",
                    Src     = "/templates/guidance/images/home-3.jpg"
                }
                        )
                    );

                #endregion

                #region Simple Slide Show
                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.SlideShow
                {
                    Id            = HtmlDbSeedConstants.WidgetId_SlideShow_Business,
                    Speed         = 4000,
                    Image1Caption = "Competence",
                    Image1Src     = "/img/SeedImages/business2_600_400.jpg",
                    Image2Caption = "Leadership",
                    Image2Src     = "/img/SeedImages/business3_600_400.jpg",
                    Image3Caption = "Teamwork",
                    Image3Src     = "/img/SeedImages/business4_600_400.jpg",
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.SlideShow
                {
                    Id            = HtmlDbSeedConstants.WidgetId_SlideShow_Nature,
                    Speed         = 4000,
                    Image1Caption = "Ants aligned on a blade of grass",
                    Image1Src     = "/img/SeedImages/nature2_600_400.jpg",
                    Image2Caption = "Coastal mist in the early morning",
                    Image2Src     = "/img/SeedImages/nature3_600_400.jpg",
                    Image3Caption = "Sun setting along the coast",
                    Image3Src     = "/img/SeedImages/nature5_600_400.jpg",
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.SlideShow
                {
                    Id            = HtmlDbSeedConstants.WidgetId_SlideShow_Animals,
                    Speed         = 4000,
                    Image1Caption = "Adult male mountain gorilla",
                    Image1Src     = "/img/SeedImages/animals2_600_400.jpg",
                    Image2Caption = "Tiger resting on a ledge",
                    Image2Src     = "/img/SeedImages/animals3_600_400.jpg",
                    Image3Caption = "Baby rhino and mother",
                    Image3Src     = "/img/SeedImages/animals1_600_400.jpg",
                }
                        )
                    );

                #endregion

                #region Hero Units

                _dbContext.JsonWidgets.Add(new JsonWidget(
                                               new Models.HeroUnit
                {
                    Id    = HtmlDbSeedConstants.WidgetId_Hero_InspirationWelcome,
                    Title = "Welcome to Inspiration School District",
                    Body  = "The mission of the Inspiration School District is to provide a child-centered environment that cultivates character, fosters academic excellence, and embraces diversity. District families, community, and staff join as partners to develop creative, exemplary learners with the skills and enthusiasm to contribute to a constantly changing global society."
                }
                                               ));

                _dbContext.JsonWidgets.Add(new JsonWidget(
                                               new Models.HeroUnit
                {
                    Id    = HtmlDbSeedConstants.WidgetId_Hero_GuidanceWelcome,
                    Title = "Welcome to Guidance High School",
                    Body  = "The mission of our school is to provide a child-centered environment that cultivates character, fosters academic excellence, and embraces diversity. District families, community, and staff join as partners to develop creative, exemplary learners with the skills and enthusiasm to contribute to a constantly changing global society."
                }
                                               ));

                #endregion

                #region Raw Html

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.RawHtml
                {
                    Id   = HtmlDbSeedConstants.WidgetId_Html_BaconIpsum,
                    Html = "Cillum beef ribs excepteur commodo corned beef esse sunt. Corned beef quis ut bacon anim, excepteur pancetta t-bone strip steak incididunt exercitation landjaeger jowl. Picanha short loin in, cillum laboris bacon sint tri-tip qui laborum tongue frankfurter do pastrami. Ground round laborum brisket, enim nostrud consectetur ribeye ut shoulder pancetta velit leberkas sirloin labore salami. Venison mollit adipisicing corned beef dolore."
                }
                        )
                    );


                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.RawHtml
                {
                    Id   = HtmlDbSeedConstants.WidgetId_Html_LoremIpsum1,
                    Html = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.RawHtml
                {
                    Id   = HtmlDbSeedConstants.WidgetId_Html_LoremIpsum2,
                    Html = "Nobis virtute elaboraret qui et. Iuvaret intellegam vituperatoribus at pro, ei malorum placerat appellantur nam. No mel epicuri senserit, ex labitur perpetua laboramus mel. Sensibus aliquando intellegam cu vis, ei pro amet accusata concludaturque, eam purto insolens no. Sed elit feugiat signiferumque ut."
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.RawHtml
                {
                    Id   = HtmlDbSeedConstants.WidgetId_Html_LoremIpsum3,
                    Html = "Dissentiet appellantur ad vis. Eros summo per et, per ne summo dolore definitiones. Et hinc corpora principes ius, id vis omnesque tractatos efficiendi. Cu epicuri fierent vis. Ex esse albucius vim, sale dolore ullamcorper pro et. Quis utamur aliquip mel in, mundi noster putant usu ea, an mea wisi voluptatibus."
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.RawHtml
                {
                    Id   = HtmlDbSeedConstants.WidgetId_Html_LoremIpsum_Long,
                    Html = "Lorem ipsum dolor sit amet, bonorum assentior temporibus qui eu. Ferri facete est cu, an erant quaeque duo. In delectus atomorum qui, saepe inciderint ne eam. Possim labitur ad vix. Eam ad dicat oporteat tincidunt.<br/><br/>In sed aeque efficiantur, mel ei facilis perpetua. Per meliore facilisi invenire ei, ut mei quando oporteat imperdiet. Minim theophrastus ut qui, at per zril salutatus definitionem. Te vel graecis inciderint. Usu te propriae accusata expetenda, sed ex elitr tantas comprehensam. Et vix wisi tation timeam.<br/><br/>Ad vim illud volumus. Ad aperiri maiestatis reformidans ius, legere salutandi intellegat an cum. Dolorem iudicabit repudiare eam at, appellantur efficiantur per ea. Vis magna comprehensam et, pro te duis fuisset, qui laoreet delectus conclusionemque ne. Nobis libris atomorum an vim. Wisi virtute an eam, tation eruditi intellegam quo no.<br/><br/>Nobis virtute elaboraret qui et. Iuvaret intellegam vituperatoribus at pro, ei malorum placerat appellantur nam. No mel epicuri senserit, ex labitur perpetua laboramus mel. Sensibus aliquando intellegam cu vis, ei pro amet accusata concludaturque, eam purto insolens no. Sed elit feugiat signiferumque ut.<br/><br/>Maluisset laboramus eloquentiam mei ad, ad enim aliquam persecuti mel. Per ne detraxit deterruisset, illud velit iudicabit mel an, cum at tation oportere. No clita volumus nam, iusto scaevola vel ex, id vix timeam dolorem omittantur. Semper nonumes eam ea, mel alii tractatos ad, eos fugit etiam ei. Amet facilisi his in. In vel alterum inimicus incorrupte, numquam recusabo duo at.<br/><br/>Dissentiet appellantur ad vis. Eros summo per et, per ne summo dolore definitiones. Et hinc corpora principes ius, id vis omnesque tractatos efficiendi. Cu epicuri fierent vis. Ex esse albucius vim, sale dolore ullamcorper pro et. Quis utamur aliquip mel in, mundi noster putant usu ea, an mea wisi voluptatibus.<br/><br/>Dicit omittam cu sed, ad harum maiorum mel. Nostrud docendi verterem ei mei, nam utamur docendi sapientem no, aliquip utroque fastidii te nam. Doming deserunt interesset ne pro, ius mucius facilis ex. Putent gloriatur sit ex, ponderum invenire eos et.<br/><br/>Pri ei quas omnium. Melius diceret legendos sed at. Vocent quaestio platonem sit an, mea cibo ferri disputationi cu, sea et nihil quaestio inciderint. Oportere interesset quo no. Sea audire expetendis an, vel diam unum utamur ne.<br/><br/>At eius lucilius facilisis mea, eum at cibo accumsan maiestatis, eam audiam equidem definitionem ut. No vis agam tota falli. Cu est placerat postulant, sea cu debet aeque, no exerci consul mea. Eam labitur accusam suscipit ex, eum cu natum probo reprimique.<br/><br/>Quo autem inani doctus in. Vis blandit ponderum cu, ei mnesarchum cotidieque referrentur eam, suas quodsi pro ex. Option dignissim vituperata quo ut. Ex hinc tibique vix, ex mea recteque salutandi. Eum et alia viris, usu munere deserunt argumentum ex. Sumo pertinax honestatis cum no, eum et vitae pericula intellegat, vix facer omnium sapientem ad."
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.RawHtml
                {
                    Id   = HtmlDbSeedConstants.WidgetId_Html_NavTop1,
                    Html = "<div><nav class=\"navbar navbar-default\"><div class=\"navbar-header\"><button class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar1\"><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span></button></div><div class=\"navbar-collapse collapse\" id=\"navbar1\"><ul class=\"nav navbar-nav\"><li><a href=\"/\">Home</a></li> <li><a href=\"/about\">About</a></li><li><a href=\"/contact\">Contact</a></li></ul></div></nav></div>"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.RawHtml
                {
                    Id   = HtmlDbSeedConstants.WidgetId_Html_NavTop2,
                    Html = "<div><nav class=\"navbar navbar-default\"><div class=\"navbar-header\"><button class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar1\"><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span></button></div><div class=\"navbar-collapse collapse\" id=\"navbar1\"><ul class=\"nav navbar-nav\"><li><a href=\"/\">Home</a></li> <li><a href=\"#\">Link</a></li><li><a href=\"#\">Link</a></li></ul></div></nav></div>"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.RawHtml
                {
                    Id   = HtmlDbSeedConstants.WidgetId_Html_NavLeft,
                    Html = "<ul class=\"list-group\"><li class=\"list-group-item\"><a href=\"#\">Link 1</a></li><li class=\"list-group-item\"><a href=\"#\">Link 2</a></li><li class=\"list-group-item\"><a href=\"#\">Link 3</a></li><li class=\"list-group-item\"><a href=\"#\">Link 4</a></li><li class=\"list-group-item\"><a href=\"#\">Link 5</a></li><li class=\"list-group-item\"><a href=\"#\">Link 6</a></li><li class=\"list-group-item\"><a href=\"#\">Link 7</a></li><li class=\"list-group-item\"><a href=\"#\">Link 8</a></li><li class=\"list-group-item\"><a href=\"#\">Link 9</a></li><li class=\"list-group-item\"><a href=\"#\">Link 10</a></li><li class=\"list-group-item\"><a href=\"#\">Link 11</a></li><li class=\"list-group-item\"><a href=\"#\">Link 12</a></li></ul>"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.RawHtml
                {
                    Id   = HtmlDbSeedConstants.WidgetId_Html_Jumbotron,
                    Html = "<div class=\"jumbotron\"><h1>Hello, world!</h1><p>This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p><p><a class=\"btn btn-primary btn-lg\" href=\"#\" role=\"button\">Learn more</a></p></div>"
                }
                        )
                    );

                _dbContext.JsonWidgets.Add(
                    new JsonWidget(
                        new Models.RawHtml
                {
                    Id   = HtmlDbSeedConstants.WidgetId_Html_SiteSearch,
                    Html = "<div class=\"input-group\"><input type=\"text\" class=\"form-control\" placeholder=\"Search...\"><span class=\"input-group-btn\"><button class=\"btn btn-default\"><i class=\"fa fa-search\"></i></button></span></div>"
                }
                        )
                    );

                #endregion
            }

            _dbContext.SaveChanges();
        }