Пример #1
0
      public static void Seed(WebDataContext context)
      {
         if( context.ControllerActionSet.Count() < 6 )
         {
            foreach( var controllerAction in context.ControllerActionSet )
            {
               context.ControllerActionSet.Remove( controllerAction );
            }
            context.SaveChanges();

            var ca = new ControllerAction()
            {
               Controller = "App",
               Action = "Index",
            };
            context.Add( ca );
            ca = new ControllerAction()
            {
               Controller = "App",
               Action = "Index",
               Optional = "Home"
            };
            context.Add( ca );
            ca = new ControllerAction()
            {
               Controller = "App",
               Action = "Index",
               Optional = "PhoneListing"
            };
            context.Add( ca );
            ca = new ControllerAction()
            {
               Controller = "App",
               Action = "Index",
               Optional = "CodeManual"
            };
            context.Add( ca );
            ca = new ControllerAction()
            {
               Controller = "App",
               Action = "Index",
               Optional = "CalendarCalculator"
            };
            context.Add( ca );
            ca = new ControllerAction()
            {
               Controller = "Admin",
               Action = "Maintenance",
               Optional = "Home"
            };
            context.Add( ca );

            context.SaveChanges();
         }

      }
Пример #2
0
      public static void Seed(WebDataContext context)
      {
         var siteRoleDefinitionId = 
            context.WidgetDefinitionSet
            .Where( def => def.Name == "User Roles" )
            .Select( def => def.Id ).FirstOrDefault();

         var adminMaintId = context
            .ControllerActionSet
            .Where( c => c.Controller == "Admin" && c.Action == "Maintenance" && c.Optional == "Home" )
            .Select( s => s.Id ).FirstOrDefault();

         if ( context.SiteRoleSet.Count() < 1 )
         {
            var siteRole = new SiteRole()
            {
               Roles = new []
               {
                  new Role()
                  {
                     Name= "Admin"
                  }
               }
            };
            context.SiteRoleSet.Add( siteRole );
            context.SaveChanges();

            var widget = new Widget()
            {
               WidgetId = siteRole.Id,
               WidgetDefinitionId = siteRoleDefinitionId,
               ControllerActionId = adminMaintId,
               Order = 1,
               Section = "Aside",
               AuthorizedRoles = "Admin;",
            };
            context.WidgetSet.Add( widget );
            context.SaveChanges();

         }
      }
Пример #3
0
      public static void Seed( WebDataContext context )
      {
         if( context.WidgetSet.Count() < 5 )
         {
            foreach( var wdgt in context.WidgetSet )
            {
               context.WidgetSet.Remove( wdgt );
            }
            context.SaveChanges();
         }

         if( context.NavMenuSet.Count() < 1 )
         {
            foreach( var menu in context.NavMenuSet )
            {
               context.NavMenuSet.Remove( menu );
            }
            context.SaveChanges();

            var nav = new NavMenu()
            {
               Name = "Main Menu",
               NavItems = new List<NavMenuItem>()
               {
                  new NavMenuItem()
                  {
                     Name = "Home",
                     Controller = "App",
                     Action = "Index",
                     Optional = "Home",
                     Order = 1
                  },
                  new NavMenuItem()
                  {
                     Name = "Phone Listing",
                     Controller = "App",
                     Action = "Index",
                     Optional = "PhoneListing",
                     Order = 2
                  },
                  new NavMenuItem()
                  {
                     Name = "Code Manual",
                     Controller = "App",
                     Action = "Index",
                     Optional = "CodeManual",
                     Order = 3
                  },
                  new NavMenuItem()
                  {
                     Name = "Calendar Calc",
                     Controller = "App",
                     Action = "Index",
                     Optional = "CalendarCalculator",
                     Order = 4
                  },
                  new NavMenuItem()
                  {
                     Name = "Admin",
                     Controller = "Admin",
                     Action = "Maintenance",
                     Optional = "Home",
                     Order = 5
                  }
               }
            };

            context.NavMenuSet.Add( nav );
            context.NavMenuItemSet.AddRange( nav.NavItems );
            context.SaveChanges();
            var widget = new Widget()
            {
               WidgetId = nav.Id,
               WidgetDefinitionId = context.WidgetDefinitionSet
                  .Where( def => def.Name == "Navigation Menu" )
                  .Select( def => def.Id ).FirstOrDefault(),
               ControllerActionId = context
                  .ControllerActionSet
                  .Where( c => c.Controller == "App" && c.Action == "Index" )
                  .Select( s => s.Id ).FirstOrDefault(),
               Section = "Sidebar",
               Order = 1,
               AuthorizedRoles = "Admin;",
            };
            context.WidgetSet.Add( widget );
            context.SaveChanges();
         }

      }
Пример #4
0
 public WebDataSeedData( WebDataContext context )
 {
    _context = context;
 }
Пример #5
0
 public AdminRepository(WebDataContext context, ILogger<AdminRepository> logger)
 {
    _context = context;
    _logger = logger;
 }
Пример #6
0
 public PageRepository(WebDataContext context, ILogger<PageRepository> logger)
 {
    _context = context;
    _logger = logger;
 }
Пример #7
0
 public EditRepository(WebDataContext context, ILogger<EditRepository> logger)
 {
    _logger = logger;
    _context = context;
 }
Пример #8
0
      public static void Seed( WebDataContext _context )
      {
         var htmlDefinitionId =
            _context.WidgetDefinitionSet
               .Where( def => def.Name == "Html Text" )
               .Select( def => def.Id ).FirstOrDefault();

         if (_context.HtmlTextSet.Count() < 5)
         {
            foreach (var text in _context.HtmlTextSet)
            {
               _context.HtmlTextSet.Remove( text );
            }
            _context.SaveChanges();

            var htmlText = new HtmlText()
            {
               Text =
                  @"<p>
                  <b>What is the Becket & Lee Intranet ?</b>
               </p>
               <p>
                  The Becket &amp; Lee Intranet is here to give B&amp;L employees quick and easy
                  access to information for individual departments as well as general company
                  information. It is accessed through Internet Explorer just like any other web
                  page so it will be easy to use by anyone who has ever surfed the internet. By
                  clicking on the links, you will be instantly connected to pages with information
                  such as Company Events, the current B&L Phone Directory, this week's Cafe Menu &amp;
                  the current Coding Manuals. In addition, our Pacer Links &amp; Information Page contains
                  links to Pacer &amp; other Bankruptcy Court websites along with the Login ID's, Passwords &amp;
                  the current status of these sites in Internet Explorer, Brass, Citrix and HyperAccess.
               </p>
               <p>
                  <b>What can I do on the Becket &amp; Lee Intranet ?</b>
               </p>
               <ul>
                  <li>
                     <b>Features you can use right now...</b>
                     <ul>
                        <li>Phone Listing Tab - View the firm's current phone listing.</li>
                        <li>Cafe' Menu - See what's cooking at <i>Mickey B's Cafe'</i>.</li>
                        <li>Coding Manuals - View the current Coding Manuals.</li>
                        <li>Pacer Links &amp; Info Page - Link to Pacer websites. View current Pacer website status. Obtain Login ID's &amp; Passwords.</li>
                     </ul>
                  </li>
               </ul>

               <p>The B&amp;L Intranet site continues to grow &amp; improve. Stop back frequently to see new additions and features. If you have a suggestion, please use the link below to submit it to our web master. </p>"
            };
            _context.HtmlTextSet.Add( htmlText );
            _context.SaveChanges();
            var widget = new Widget()
            {
               WidgetId = htmlText.Id,
               WidgetDefinitionId = htmlDefinitionId,
               ControllerActionId = _context.ControllerActionSet
                  .Where( c => c.Controller == "App" && c.Action == "Index"  && c.Optional == "Home" )
                  .Select( c => c.Id ).FirstOrDefault(),
               Order = 1,
               Section = "Main",
               AuthorizedRoles = "Admin;",
            };
            _context.WidgetSet.Add( widget );
            _context.SaveChanges();

            htmlText = new HtmlText()
            {
               Title = "Lorem ipsum dolor",
               Text = @"<p>Lorem ipsum dolor sit amet, cibo mutat timeam ea mel. An duis denique noluisse sit, porro iuvaret te his. Lucilius voluptatum cotidieque eu eum. Sit dolorum iracundia id, stet falli quo ea. Te mel atomorum euripidis, his cu legere postulant.
                     </p><p>Ius causae minimum cu, nam id mandamus vulputate. Qui mollis copiosae ea, tibique detraxit percipitur eu mea. Ea atqui soleat maluisset ius. Id dico mutat meliore sea. Case aliquam facilisi ius an, mea ne quem tempor, fabulas sadipscing id nec.
                     </p><p>Nisl legendos facilisis has ea. Nibh nobis ne cum. Mea etiam interesset ea, nec wisi integre mandamus at. Id mea persius inermis disputationi, lobortis erroribus quo ad, id vix vitae labitur commune.</p>"
            };
            _context.HtmlTextSet.Add( htmlText );
            _context.SaveChanges();
            widget = new Widget()
            {
               WidgetId = htmlText.Id,
               WidgetDefinitionId = htmlDefinitionId,
               ControllerActionId = _context.ControllerActionSet
                  .Where( c => c.Controller == "App" && c.Action == "Index" && c.Optional == "Home" )
                  .Select( c => c.Id ).FirstOrDefault(),
               Order = 2,
               Section = "Main",
               AuthorizedRoles = "Admin;",
            };
            _context.WidgetSet.Add( widget );
            _context.SaveChanges();

            htmlText = new HtmlText()
            {
               Title = "Aside Test",
               Text = @"<p>Ea usu modo clita constituto, partiendo assentior ea mei, tota impetus voluptua ea sit. Blandit suavitate urbanitas pro an. Pro diceret dolorum probatus in, altera salutatus pertinacia ad mei, et vis doctus delicatissimi. Graece fabellas insolens eos et. Cu est inermis scribentur consequuntur, qui nostrum definiebas an, an sed iracundia mediocritatem.
                  </p><p>At eirmod ceteros adipiscing mel. An has odio dolores, no mazim voluptatibus vituperatoribus duo. Eum wisi everti at, mea te falli tation utamur. Id albucius tractatos duo, ei vis purto altera. At eirmod nostrud docendi eum, eos ex admodum voluptatibus. Mel ea quot possim, usu no impetus debitis</p>"
            };
            _context.HtmlTextSet.Add( htmlText );
            _context.SaveChanges();
            widget = new Widget()
            {
               WidgetId = htmlText.Id,
               WidgetDefinitionId = htmlDefinitionId,
               ControllerActionId = _context.ControllerActionSet
                  .Where( c => c.Controller == "App" && c.Action == "Index" && c.Optional == "Home" )
                  .Select( c => c.Id ).FirstOrDefault(),
               Order = 1,
               Section = "Aside",
               AuthorizedRoles = "Admin;",
            };
            _context.WidgetSet.Add( widget );
            _context.SaveChanges();

            htmlText = new HtmlText()
            {
               Title = "Lorem ipsum",
               Text = @"<p>Lorem ipsum dolor sit amet, cibo mutat timeam ea mel. An duis denique noluisse sit, porro iuvaret te his. Lucilius voluptatum cotidieque eu eum. Sit dolorum iracundia id, stet falli quo ea. Te mel atomorum euripidis, his cu legere postulant.
                     </p><p>Ius causae minimum cu, nam id mandamus vulputate. Qui mollis copiosae ea, tibique detraxit percipitur eu mea. Ea atqui soleat maluisset ius. Id dico mutat meliore sea. Case aliquam facilisi ius an, mea ne quem tempor, fabulas sadipscing id nec.
                     </p><p>Nisl legendos facilisis has ea. Nibh nobis ne cum. Mea etiam interesset ea, nec wisi integre mandamus at. Id mea persius inermis disputationi, lobortis erroribus quo ad, id vix vitae labitur commune.</p>"

            };
            _context.HtmlTextSet.Add( htmlText );
            _context.SaveChanges();
            widget = new Widget()
            {
               WidgetId = htmlText.Id,
               WidgetDefinitionId = htmlDefinitionId,
               ControllerActionId = _context.ControllerActionSet
                  .Where( c => c.Controller == "App" && c.Action == "Index" && c.Optional == "Home" )
                  .Select( c => c.Id ).FirstOrDefault(),
               Order = 2,
               Section = "Aside",
               AuthorizedRoles = "Admin;",
            };
            _context.WidgetSet.Add( widget );
            _context.SaveChanges();


            htmlText = new HtmlText()
            {
               Title = "Phone ipsum",
               Text = @"<p>Lorem ipsum dolor sit amet, cibo mutat timeam ea mel. An duis denique noluisse sit, porro iuvaret te his. Lucilius voluptatum cotidieque eu eum. Sit dolorum iracundia id, stet falli quo ea. Te mel atomorum euripidis, his cu legere postulant.
                     </p><p>Ius causae minimum cu, nam id mandamus vulputate. Qui mollis copiosae ea, tibique detraxit percipitur eu mea. Ea atqui soleat maluisset ius. Id dico mutat meliore sea. Case aliquam facilisi ius an, mea ne quem tempor, fabulas sadipscing id nec.
                     </p><p>Nisl legendos facilisis has ea. Nibh nobis ne cum. Mea etiam interesset ea, nec wisi integre mandamus at. Id mea persius inermis disputationi, lobortis erroribus quo ad, id vix vitae labitur commune.</p>"

            };
            _context.HtmlTextSet.Add( htmlText );
            _context.SaveChanges();
            widget = new Widget()
            {
               WidgetId = htmlText.Id,
               WidgetDefinitionId = htmlDefinitionId,
               ControllerActionId = _context.ControllerActionSet
                  .Where( c => c.Controller == "App" && c.Action == "Index" && c.Optional == "PhoneListing" )
                  .Select( c => c.Id ).FirstOrDefault(),
               Order = 1,
               Section = "Main",
               AuthorizedRoles = "Admin;",
            };
            _context.WidgetSet.Add( widget );
            _context.SaveChanges();

         }
      }