コード例 #1
0
 private void CreateSlide(TeduShopDbContext context)
 {
     if (context.Slides.Count() == 0)
     {
         List <Slide> listSlide = new List <Slide>()
         {
             new Slide()
             {
                 Name         = "Slide 1",
                 DisplayOrder = 1,
                 Status       = true, Url = "#",
                 Image        = "https://cdn.tgdd.vn/qcao/22_12_2018_07_17_45_galaxy-s9-plus-800-300.png",
                 Content      = @""
             },
             //new Slide(){Name="Slide 2",
             //    DisplayOrder =2,
             //    Status =true,
             //    Url ="#",
             //    Image ="/Assets/client/images/bag1.jpg",
             //    Content =@"<h2>FLAT 50% 0FF</h2>
             //            <label>FOR ALL PURCHASE <b>VALUE</b></label>
             //            <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et </ p >
             //            < span class=""on-get"">GET NOW</span>"}
         };
         context.Slides.AddRange(listSlide);
         context.SaveChanges();
     }
 }
コード例 #2
0
 private void CreateContactDetail(TeduShopDbContext context)
 {
     if (context.ContactDetails.Count() == 0)
     {
         try
         {
             var contactDetail = new TeduShop.Model.Models.ContactDetail()
             {
                 Name    = "Shop thời trang TEDU",
                 Address = "Ngõ 77 Xuân La",
                 Email   = "*****@*****.**",
                 Lat     = 21.0633645,
                 Lng     = 105.8053274,
                 Phone   = "095423233",
                 Website = "http://tedu.com.vn",
                 Other   = "",
                 Status  = true
             };
             context.ContactDetails.Add(contactDetail);
             context.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             foreach (var eve in ex.EntityValidationErrors)
             {
                 Trace.WriteLine($"Entity of type \"{eve.Entry.Entity.GetType().Name}\" in state \"{eve.Entry.State}\" has the following validation error.");
                 foreach (var ve in eve.ValidationErrors)
                 {
                     Trace.WriteLine($"- Property: \"{ve.PropertyName}\", Error: \"{ve.ErrorMessage}\"");
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: Configuration.cs プロジェクト: LeAnhNhan76/TeduShop
 private void CreateClient(TeduShopDbContext context)
 {
     if (!context.Clients.Any())
     {
         var clients = new List <Client>()
         {
             new Client
             {
                 ClientId             = "BIG_SHOPE",
                 ClientSecret         = "9ebdca36-9c0a-4c57-8dc6-2636af8777aa",
                 ClientName           = "Big Shope",
                 CreatedDate          = DateTime.Now,
                 RefreshTokenLifeTime = 7200,
                 AllowedOrigin        = "*",
                 IsActive             = true
             },
             new Client
             {
                 ClientId             = "Grab",
                 ClientSecret         = "75c114ed-cbfb-483a-a998-05cb27f376a8",
                 ClientName           = "Grab",
                 CreatedDate          = DateTime.Now,
                 RefreshTokenLifeTime = 7200,
                 AllowedOrigin        = "*",
                 IsActive             = true
             }
         };
         context.Clients.AddRange(clients);
         context.SaveChanges();
     }
 }
コード例 #4
0
ファイル: Configuration.cs プロジェクト: LeAnhNhan76/TeduShop
 private void CreateProductCategorySample(TeduShopDbContext context)
 {
     if (!context.ProductCategories.Any())
     {
         var productCategoryList = new List <ProductCategory>()
         {
             new ProductCategory()
             {
                 Name = "Mỹ phẩm", Alias = "my-pham", HomeFlag = true, CreatedDate = DateTime.Now, CreatedBy = "admin", UpdatedDate = DateTime.Now, UpdatedBy = "admin"
             },
             new ProductCategory()
             {
                 Name = "Thực phẩm", Alias = "thuc-pham", HomeFlag = true, CreatedDate = DateTime.Now, CreatedBy = "admin", UpdatedDate = DateTime.Now, UpdatedBy = "admin"
             },
             new ProductCategory()
             {
                 Name = "Quần áo", Alias = "quan-ao", HomeFlag = true, CreatedDate = DateTime.Now, CreatedBy = "admin", UpdatedDate = DateTime.Now, UpdatedBy = "admin"
             },
             new ProductCategory()
             {
                 Name = "Giày dép", Alias = "giay-dep", HomeFlag = true, CreatedDate = DateTime.Now, CreatedBy = "admin", UpdatedDate = DateTime.Now, UpdatedBy = "admin"
             },
         };
         context.ProductCategories.AddRange(productCategoryList);
         context.SaveChanges();
     }
 }
コード例 #5
0
ファイル: Configuration.cs プロジェクト: LeAnhNhan76/TeduShop
 private void CreateContactDetail(TeduShopDbContext context)
 {
     if (!context.ContactDetails.Any())
     {
         try
         {
             var contactDetail = new TeduShop.Model.Models.ContactDetail()
             {
                 Name    = "Shop thời trang TEDU",
                 Address = "23 Nguyễn Thị Huỳnh, phường 8, quận Phú Nhuận",
                 Email   = "*****@*****.**",
                 Lat     = 10.7969016,
                 Lng     = 106.6741883,
                 Phone   = "0339700824",
                 Website = "http://tedu.com.vn",
                 Other   = "",
                 Status  = true
             };
             context.ContactDetails.Add(contactDetail);
             context.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             foreach (var eve in ex.EntityValidationErrors)
             {
                 Trace.WriteLine($"Entity of type \"{eve.Entry.Entity.GetType().Name}\" in state \"{eve.Entry.State}\" has the following validation error.");
                 foreach (var ve in eve.ValidationErrors)
                 {
                     Trace.WriteLine($"- Property: \"{ve.PropertyName}\", Error: \"{ve.ErrorMessage}\"");
                 }
             }
         }
     }
 }
コード例 #6
0
 private void CreatePage(TeduShopDbContext context)
 {
     if (context.Pages.Count() == 0)
     {
         try
         {
             var page = new Page()
             {
                 Name    = "Giới thiệu",
                 Alias   = "gioi-thieu",
                 Content = @"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium ",
                 Status  = true
             };
             context.Pages.Add(page);
             context.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             foreach (var eve in ex.EntityValidationErrors)
             {
                 Trace.WriteLine($"Entity of type \"{eve.Entry.Entity.GetType().Name}\" in state \"{eve.Entry.State}\" has the following validation error.");
                 foreach (var ve in eve.ValidationErrors)
                 {
                     Trace.WriteLine($"- Property: \"{ve.PropertyName}\", Error: \"{ve.ErrorMessage}\"");
                 }
             }
         }
     }
 }
コード例 #7
0
ファイル: Configuration.cs プロジェクト: nclong92/tedushop
        private void CreateProductCategorySample(TeduShopDbContext context)
        {
            if (context.ProductCategories.Count() == 0)
            {
                List <ProductCategory> productCategories = new List <ProductCategory>()
                {
                    new ProductCategory()
                    {
                        Name = "điện lạnh", Alias = "dien-lanh", Status = true
                    },
                    new ProductCategory()
                    {
                        Name = "viễn thông", Alias = "vien-thong", Status = true
                    },
                    new ProductCategory()
                    {
                        Name = "đồ gia dụng", Alias = "do-gia-dung", Status = true
                    },
                    new ProductCategory()
                    {
                        Name = "Mỹ phẩm", Alias = "my-pham", Status = true
                    }
                };

                context.ProductCategories.AddRange(productCategories);
                context.SaveChanges();
            }
        }
コード例 #8
0
ファイル: Configuration.cs プロジェクト: LeAnhNhan76/TeduShop
 private void CreateFooterSample(TeduShopDbContext context)
 {
     if (!context.Footers.Any(x => x.ID == Constant.DefaultFooterId))
     {
         var footer = new Footer()
         {
             ID      = Constant.DefaultFooterId,
             Content = "This is footer section"
         };
         context.Footers.Add(footer);
         context.SaveChanges();
     }
 }
コード例 #9
0
 private void CreateFooter(TeduShopDbContext context)
 {
     if (context.Footers.Count(x => x.ID == CommonConstants.DefaultFooterId) == 0)
     {
         string content = "Footer";
         context.Footers.Add(new Footer()
         {
             ID      = CommonConstants.DefaultFooterId,
             Content = content
         });
         context.SaveChanges();
     }
 }
コード例 #10
0
 private void CreatePages(TeduShopDbContext context)
 {
     if (context.Pages.Count() == 0)
     {
         var page = new Page()
         {
             Alias   = "gioi-thieu",
             Content = "HP 280 G3 SFF là sự cân đối hài hòa giữa hiệu năng, chất lượng và giá thành đối với một máy tính để bàn dành cho doanh nghiệp. Được thiết kế để đáp ứng tối đa nhu cầu làm việc mỗi ngày, dòng máy tính để bàn HP 280 G3 với sức mạnh xử lý đáng kinh ngạc và cung cấp nhiều tùy chọn cấu hình đi kèm sẽ là lựa chọn mang lại hiệu quả kinh tế cho doanh nghiệp.",
             Name    = "Giới thiệu trang web"
         };
         context.Pages.Add(page);
         context.SaveChanges();
     }
 }
コード例 #11
0
ファイル: Configuration.cs プロジェクト: nclong92/tedushop
        private void CreatePage(TeduShopDbContext context)
        {
            if (context.Pages.Count() == 0)
            {
                var page = new Page()
                {
                    Name    = "Giới thiệu",
                    Alias   = "gioi-thieu",
                    Content = "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.",
                    Status  = true
                };

                context.Pages.Add(page);
                context.SaveChanges();
            }
        }
コード例 #12
0
        private void ContentSlides(TeduShopDbContext context)
        {
            if (context.Slides.Count() == 0)
            {
                List <Slide> lstSlide = new List <Slide>()
                {
                    new Slide()
                    {
                        Name         = "Slide 1",
                        DisplayOrder = 1,
                        Status       = true,
                        URL          = "#",
                        Image        = "/Assets/Client/images/bag.jpg",
                        Description  = @"<h2>FLAT 50% 0FF</h2>
								<label>FOR ALL PURCHASE <b>VALUE</b></label>
								<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et </p>
								<span class=""on-get"">GET NOW</span>"
                    },
                    new Slide()
                    {
                        Name         = "Slide 2",
                        DisplayOrder = 2,
                        Status       = true,
                        URL          = "#",
                        Image        = "/Assets/Client/images/bag.jpg",
                        Description  = @"<h2>FLAT 50% 0FF</h2>
								<label>FOR ALL PURCHASE <b>VALUE</b></label>
								<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et </p>
								<span class=""on-get"">GET NOW</span>"
                    },
                    new Slide()
                    {
                        Name         = "Slide 3",
                        DisplayOrder = 3,
                        Status       = true,
                        URL          = "#",
                        Image        = "/Assets/Client/images/bag1.jpg",
                        Description  = @"<h2>FLAT 50% 0FF</h2>
								<label>FOR ALL PURCHASE <b>VALUE</b></label>
								<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et </p>
								<span class=""on-get"">GET NOW</span>"
                    }
                };
                context.Slides.AddRange(lstSlide);
                context.SaveChanges();
            }
        }
コード例 #13
0
 private void CreateSlide(TeduShopDbContext context)
 {
     if (context.Slides.Count() == 0)
     {
         List <Slide> listSlide = new List <Slide>()
         {
             new Slide()
             {
                 Name         = "Slide 1",
                 DisplayOrder = 1,
                 Status       = true,
                 Url          = "#",
                 Image        = "/Assets/client/images/bik1.jpg",
                 Content      = @"   <a href=""#""><h5>Mountain Bike 1<span>$114.00</span></h5></a>
             <a class=""add-cart"" href=""single.html"">Quick Views</a>
             <a class=""qck"" href=""single.html"">BUY NOWs</a>"
             },
             new Slide()
             {
                 Name         = "Slide 2",
                 DisplayOrder = 2,
                 Status       = true,
                 Url          = "#",
                 Image        = "/Assets/client/images/bik2.jpg",
                 Content      = @"   <a href=""#""><h5>Mountain Bike 2 <span>$70.00</span></h5></a>
             <a class=""add-cart"" href=""single.html"">Quick View</a>
             <a class=""qck"" href=""single.html"">BUY NOW</a>"
             },
             new Slide()
             {
                 Name         = "Slide 3",
                 DisplayOrder = 3,
                 Status       = true,
                 Url          = "#",
                 Image        = "/Assets/client/images/bik3.jpg",
                 Content      = @"   <a href=""#""><h5>Mountain Bike 3 <span>$40.00</span></h5></a>
             <a class=""add-cart"" href=""single.html"">Quick View</a>
             <a class=""qck"" href=""single.html"">BUY NOW</a>"
             }
         };
         context.Slides.AddRange(listSlide);
         context.SaveChanges();
     }
 }
コード例 #14
0
ファイル: Configuration.cs プロジェクト: nclong92/tedushop
        private void CreateContactDetail(TeduShopDbContext context)
        {
            if (context.ContactDetails.Count() == 0)
            {
                var contactDetail = new ContactDetail()
                {
                    Name    = "Shop thời trang",
                    Address = "Dư Dụ, Thanh Oai, Hà Nội",
                    Phone   = "12345678",
                    Email   = "*****@*****.**",
                    Lat     = 20.8693464,
                    Lng     = 105.82042,
                    Status  = true
                };

                context.ContactDetails.Add(contactDetail);
                context.SaveChanges();
            }
        }
コード例 #15
0
 private void CreateContactDetails(TeduShopDbContext context)
 {
     if (context.ContactDetails.Count() == 0)
     {
         var contactDetail = new ContactDetail()
         {
             Name    = "Shop bán hàng .NET",
             Address = "Khu phố 6, P.Linh Trung, Q.Thủ Đức, Tp.Hồ Chí Minh.",
             Email   = "*****@*****.**",
             Lat     = 10.8702164,
             Lng     = 106.8006988,
             Phone   = "0938422612",
             Website = "https://www.uit.edu.vn/",
             Other   = "",
             Status  = true
         };
         context.ContactDetails.Add(contactDetail);
         context.SaveChanges();
     }
 }
コード例 #16
0
 private void CreatePage(TeduShopDbContext context)
 {
     if (context.Pages.Count() == 0)
     {
         var page = new Page()
         {
             Name    = "Giới thiệu",
             Alias   = "gioi-thieu",
             Content = @"It is a long established fact that a reader will be distracted by the readable 
                         content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less 
                         normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. 
                         Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search 
                         for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, 
                         sometimes by accident, sometimes on purpose (injected humour and the like).",
             Status  = true
         };
         context.Pages.Add(page);
         context.SaveChanges();
     }
 }
コード例 #17
0
 private void CreateContactDetail(TeduShopDbContext context)
 {
     if (context.ThongTinLienLacs.Count() == 0)
     {
         try
         {
             var contactDetail = new TeduShop.Model.Model.ThongTinLienLac()
             {
                 TenLienLac     = "Shop linh kiện 88",
                 AddressLienLac = "số 81 Quang Trung",
                 EmailLienLac   = "*****@*****.**",
                 TrangThai      = true,
                 LatLienLac     = 21.2752592,
                 LgnLienLac     = 106.1888829,
                 SoDienThoai    = "0961077031",
                 WebSiteLienLac = "linhkien88.com.vn",
                 OtherLienLac   = ""
             };
             context.ThongTinLienLacs.Add(contactDetail);
             context.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             foreach (var exeve in ex.EntityValidationErrors)
             {
                 Trace.WriteLine($"Entity of type  \"{exeve.Entry.Entity.GetType().Name}\"" +
                                 $" in state \"{exeve.Entry.State}\" has the following validate error :"
                                 );
                 foreach (var ex1 in exeve.ValidationErrors)
                 {
                     Trace.WriteLine($"- Property : \"{ex1.PropertyName}\", error: \"{ex1.ErrorMessage}");
                 }
             }
         }
     }
 }
コード例 #18
0
 public void Commit()
 {
     dbContext.SaveChanges();
 }
コード例 #19
0
        private void CreateFunction(TeduShopDbContext context)
        {
            if (context.Functions.Count() == 0)
            {
                context.Functions.AddRange(new List <Function>()
                {
                    new Function()
                    {
                        ID = "SYSTEM", Name = "Hệ thống", ParentId = null, DisplayOrder = 1, Status = true, URL = "/", IconCss = "fa-desktop"
                    },
                    new Function()
                    {
                        ID = "ROLE", Name = "Nhóm", ParentId = "SYSTEM", DisplayOrder = 1, Status = true, URL = "/main/role/index", IconCss = "fa-home"
                    },
                    new Function()
                    {
                        ID = "FUNCTION", Name = "Chức năng", ParentId = "SYSTEM", DisplayOrder = 2, Status = true, URL = "/main/function/index", IconCss = "fa-home"
                    },
                    new Function()
                    {
                        ID = "USER", Name = "Người dùng", ParentId = "SYSTEM", DisplayOrder = 3, Status = true, URL = "/main/user/index", IconCss = "fa-home"
                    },
                    new Function()
                    {
                        ID = "ACTIVITY", Name = "Nhật ký", ParentId = "SYSTEM", DisplayOrder = 4, Status = true, URL = "/main/activity/index", IconCss = "fa-home"
                    },
                    new Function()
                    {
                        ID = "ERROR", Name = "Lỗi", ParentId = "SYSTEM", DisplayOrder = 5, Status = true, URL = "/main/error/index", IconCss = "fa-home"
                    },
                    new Function()
                    {
                        ID = "SETTING", Name = "Cấu hình", ParentId = "SYSTEM", DisplayOrder = 6, Status = true, URL = "/main/setting/index", IconCss = "fa-home"
                    },

                    new Function()
                    {
                        ID = "PRODUCT", Name = "Sản phẩm", ParentId = null, DisplayOrder = 2, Status = true, URL = "/", IconCss = "fa-chevron-down"
                    },
                    new Function()
                    {
                        ID = "PRODUCT_CATEGORY", Name = "Danh mục", ParentId = "PRODUCT", DisplayOrder = 1, Status = true, URL = "/main/product-category/index", IconCss = "fa-chevron-down"
                    },
                    new Function()
                    {
                        ID = "PRODUCT_LIST", Name = "Sản phẩm", ParentId = "PRODUCT", DisplayOrder = 2, Status = true, URL = "/main/product/index", IconCss = "fa-chevron-down"
                    },
                    new Function()
                    {
                        ID = "ORDER", Name = "Hóa đơn", ParentId = "PRODUCT", DisplayOrder = 3, Status = true, URL = "/main/order/index", IconCss = "fa-chevron-down"
                    },

                    new Function()
                    {
                        ID = "CONTENT", Name = "Nội dung", ParentId = null, DisplayOrder = 3, Status = true, URL = "/", IconCss = "fa-table"
                    },
                    new Function()
                    {
                        ID = "POST_CATEGORY", Name = "Danh mục", ParentId = "CONTENT", DisplayOrder = 1, Status = true, URL = "/main/post-category/index", IconCss = "fa-table"
                    },
                    new Function()
                    {
                        ID = "POST", Name = "Bài viết", ParentId = "CONTENT", DisplayOrder = 2, Status = true, URL = "/main/post/index", IconCss = "fa-table"
                    },

                    new Function()
                    {
                        ID = "UTILITY", Name = "Tiện ích", ParentId = null, DisplayOrder = 4, Status = true, URL = "/", IconCss = "fa-clone"
                    },
                    new Function()
                    {
                        ID = "FOOTER", Name = "Footer", ParentId = "UTILITY", DisplayOrder = 1, Status = true, URL = "/main/footer/index", IconCss = "fa-clone"
                    },
                    new Function()
                    {
                        ID = "FEEDBACK", Name = "Phản hồi", ParentId = "UTILITY", DisplayOrder = 2, Status = true, URL = "/main/feedback/index", IconCss = "fa-clone"
                    },
                    new Function()
                    {
                        ID = "ANNOUNCEMENT", Name = "Thông báo", ParentId = "UTILITY", DisplayOrder = 3, Status = true, URL = "/main/announcement/index", IconCss = "fa-clone"
                    },
                    new Function()
                    {
                        ID = "CONTACT", Name = "Lien hệ", ParentId = "UTILITY", DisplayOrder = 4, Status = true, URL = "/main/contact/index", IconCss = "fa-clone"
                    },

                    new Function()
                    {
                        ID = "REPORT", Name = "Báo cáo", ParentId = null, DisplayOrder = 5, Status = true, URL = "/", IconCss = "fa-bar-chart-o"
                    },
                    new Function()
                    {
                        ID = "REVENUES", Name = "Báo cáo doanh thu", ParentId = "REPORT", DisplayOrder = 1, Status = true, URL = "/main/report/revenues", IconCss = "fa-bar-chart-o"
                    },
                    new Function()
                    {
                        ID = "ACCESS", Name = "Báo cáo truy cập", ParentId = "REPORT", DisplayOrder = 2, Status = true, URL = "/main/report/visitor", IconCss = "fa-bar-chart-o"
                    },
                    new Function()
                    {
                        ID = "READER", Name = "Báo cáo độc giả", ParentId = "REPORT", DisplayOrder = 3, Status = true, URL = "/main/report/reader", IconCss = "fa-bar-chart-o"
                    },
                });
                context.SaveChanges();
            }
        }
コード例 #20
0
        private void CreateRole(TeduShopDbContext context)
        {
            if (!context.ApplicationRoles.Any())
            {
                var roles = new List <ApplicationRole>()
                {
                    new ApplicationRole()
                    {
                        Name = Role.CreateIntiniativeForAdmin, Description = "Có thể tạo và nộp đơn sáng kiến giúp cho các đơn vị khác.", IsDeactive = false
                    },
                    new ApplicationRole()
                    {
                        Name = Role.ViewIntiniativeForAdmin, Description = "Hiển thị danh mục sáng kiến cho sở Khoa Học và Công Nghệ.", IsDeactive = false
                    },
                    new ApplicationRole()
                    {
                        Name = Role.ViewIntiniativeForUser, Description = "Hiển thị danh mục sáng kiến", IsDeactive = false
                    },
                    new ApplicationRole()
                    {
                        Name = Role.CreateIntiniativeForUser, Description = "Nộp đơn sáng kiến", IsDeactive = false
                    },

                    new ApplicationRole()
                    {
                        Name = Role.ViewUser, Description = "Hiển thị danh mục tài khoản của các đơn vị.", IsDeactive = false
                    },
                    new ApplicationRole()
                    {
                        Name = Role.CreateUser, Description = "Tạo mới tài khoản cho một đơn vị.", IsDeactive = false
                    },
                    new ApplicationRole()
                    {
                        Name = Role.EditUser, Description = "Cập nhập tài khoản cho một đơn vị.", IsDeactive = false
                    },
                    new ApplicationRole()
                    {
                        Name = Role.DeleteUser, Description = "Xóa tài khoản", IsDeactive = false
                    },

                    new ApplicationRole()
                    {
                        Name = Role.ViewField, Description = "Hiển thị danh mục Lĩnh Vực", IsDeactive = false
                    },
                    new ApplicationRole()
                    {
                        Name = Role.CreateField, Description = "Tạo nhóm Lĩnh Vực", IsDeactive = false
                    },
                    new ApplicationRole()
                    {
                        Name = Role.EditField, Description = "Cập nhập Lĩnh Vực", IsDeactive = false
                    },
                    new ApplicationRole()
                    {
                        Name = Role.DeleteField, Description = "Xóa Lĩnh Vực", IsDeactive = false
                    },

                    new ApplicationRole()
                    {
                        Name = Role.ViewFieldGroup, Description = "Hiển thị danh mục nhóm Lĩnh Vực", IsDeactive = false
                    },
                    new ApplicationRole()
                    {
                        Name = Role.CreateFieldGroup, Description = "Tạo nhóm Lĩnh Vự.", IsDeactive = false
                    },
                    new ApplicationRole()
                    {
                        Name = Role.EditFieldGroup, Description = "Cập nhập nhóm Lĩnh Vực", IsDeactive = false
                    },
                    new ApplicationRole()
                    {
                        Name = Role.DeleteFieldGroup, Description = "Xóa nhóm Lĩnh Vực", IsDeactive = false
                    },
                };

                context.ApplicationRoles.AddRange(roles.Distinct());

                context.SaveChanges();
            }

            if (!context.ApplicationGroups.Any())
            {
                context.ApplicationGroups.AddRange(new List <ApplicationGroup>()
                {
                    new ApplicationGroup()
                    {
                        Name = Role.SupperAdmin, Description = "Quản trị viên", IsDeactive = false
                    },
                    new ApplicationGroup()
                    {
                        Name = Role.Admin, Description = "Sở Khoa Học và Công Nghệ", IsDeactive = false
                    },
                    new ApplicationGroup()
                    {
                        Name = Role.User, Description = "Đơn vị", IsDeactive = false
                    },
                });
                context.SaveChanges();
            }
        }
コード例 #21
0
ファイル: Configuration.cs プロジェクト: nclong92/tedushop
        private void CreateFooter(TeduShopDbContext context)
        {
            if (context.Footers.Count(x => x.ID == CommonConstants.DefaultFooterID) == 0)
            {
                string content = @"<div class='footer-bottom-cate'>
                <h6>CATEGORIES</h6>
                <ul>
                    <li><a href='#'>Curabitur sapien</a></li>
                    <li><a href='#'>Dignissim purus</a></li>
                    <li><a href='#'>Tempus pretium</a></li>
                    <li><a href='#'>Dignissim neque</a></li>
                    <li><a href='#'>Ornared id aliquet</a></li>
                    <li><a href='#'>Ultrices id du</a></li>
                    <li><a href='#'>Commodo sit</a></li>
                    <li><a href='#'>Urna ac tortor sc</a></li>
                    <li><a href='#'>Ornared id aliquet</a></li>
                    <li><a href='#'>Urna ac tortor sc</a></li>
                    <li><a href='#'>Eget nisi laoreet</a></li>
                    <li><a href='#'>Faciisis ornare</a></li>
                </ul>
            </div>
            <div class='footer-bottom-cate bottom-grid-cat'>
                <h6>FEATURE PROJECTS</h6>
                <ul>
                    <li><a href='#'>Curabitur sapien</a></li>
                    <li><a href='#'>Dignissim purus</a></li>
                    <li><a href='#'>Tempus pretium</a></li>
                    <li><a href='#'>Dignissim neque</a></li>
                    <li><a href='#'>Ornared id aliquet</a></li>
                    <li><a href='#'>Ultrices id du</a></li>
                    <li><a href='#'>Commodo sit</a></li>
                </ul>
            </div>
            <div class='footer-bottom-cate'>
                <h6>TOP BRANDS</h6>
                <ul>
                    <li><a href='#'>Curabitur sapien</a></li>
                    <li><a href='#'>Dignissim purus</a></li>
                    <li><a href='#'>Tempus pretium</a></li>
                    <li><a href='#'>Dignissim neque</a></li>
                    <li><a href='#'>Ornared id aliquet</a></li>
                    <li><a href='#'>Ultrices id du</a></li>
                    <li><a href='#'>Commodo sit</a></li>
                    <li><a href='#'>Urna ac tortor sc</a></li>
                    <li><a href='#'>Ornared id aliquet</a></li>
                    <li><a href='#'>Urna ac tortor sc</a></li>
                    <li><a href='#'>Eget nisi laoreet</a></li>
                    <li><a href='#'>Faciisis ornare</a></li>
                </ul>
            </div>
            <div class='footer-bottom-cate cate-bottom'>
                <h6>OUR ADDERSS</h6>
                <ul>
                    <li>Aliquam metus  dui. </li>
                    <li>orci, ornareidquet</li>
                    <li> ut,DUI.</li>
                    <li>nisi, dignissim</li>
                    <li>gravida at.</li>
                    <li class='phone'>PH : 6985792466</li>
                    <li class='temp'> <p class='footer-class'>Design by <a href='http://w3layouts.com/' target='_blank'>W3layouts</a> </p></li>
                </ul>
            </div>
            <div class='clearfix'> </div>";

                var footer = new Footer()
                {
                    ID      = CommonConstants.DefaultFooterID,
                    Content = content
                };

                context.Footers.Add(footer);
                context.SaveChanges();
            }
        }