private void CreateConfigTittle(HLShopDbContext context) { if (!context.SystemConfigs.Any(x => x.Code == "HomeTitle")) { context.SystemConfigs.Add(new SystemConfig() { Code = "HomeTitle", ValueString = "Trang chủ HULA Sports" }); } if (!context.SystemConfigs.Any(x => x.Code == "HomeMetaKeyword")) { context.SystemConfigs.Add(new SystemConfig() { Code = "HomeMetaKeyword", ValueString = "Trang chủ HULA Sports" }); } if (!context.SystemConfigs.Any(x => x.Code == "HomeMetaDescription")) { context.SystemConfigs.Add(new SystemConfig() { Code = "HomeMetaDescription", ValueString = "Trang chủ HULA Sports" }); } }
private void CreateUser(HLShopDbContext context) { if (!context.Users.Any()) { var manager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new HLShopDbContext())); var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(new HLShopDbContext())); var user = new ApplicationUser() { UserName = "******", Email = "*****@*****.**", EmailConfirmed = true, BirthDay = DateTime.Now, Fullname = "Nguyen Huu Lam" }; manager.Create(user, "1234564$"); if (!roleManager.Roles.Any()) { roleManager.Create(new IdentityRole { Name = "Admin" }); roleManager.Create(new IdentityRole { Name = "User" }); } var adminUser = manager.FindByEmail("*****@*****.**"); manager.AddToRoles(adminUser.Id, new string[] { "Admin", "User" }); } }
private void CreatePage(HLShopDbContext context) { if (context.Pages.Count() == 0) { var page = new Page() { Name = "Introduction", Alias = "gioi-thieu", Content = "There was an advert in the 90’s which said “it does exactly what it says on the tin” and with Classicfootballshirts you pretty much get the same! Founded by two students at Uni in Manchester the company has grown to become one of the world’s leading suppliers of retro football shirts. Starting by simply selling their own collection on eBay, the students found there was a huge demand for retro football shirts and began sourcing shirts from around the globe. In 10 years Classic Football Co. has grown to a company with a £multi-million turnover employing 20 members of staff." + "At the start of each season, the kitman at a football club will order a certain number of kit and if they don’t use them all then what happens to it? Well Classicfootballshirts buys all the stock they have left and puts it on their site. It’s not just football shirts, when I went around the warehouse there were football boots, shorts, even AC Milan underpants!" + "With football clubs changing kits so frequently grrrrrr, retailers and manufacturers can get left with stock left over. The Classic Football Co. takes this stock and sells it on. Many of the items are brand new still in their original packaging!", Status = true }; context.Pages.Add(page); context.SaveChanges(); } }
private void CreateContextDetail(HLShopDbContext context) { if (context.ContactDetails.Count() == 0) { var contactDetail = new ContactDetail() { Name = "HULA Sports", Phone = "0984545747", Email = "*****@*****.**", Website = "http://hulasports.vn", Address = "Thanh Binh service complex, Thanh Binh, Chuong My, Hanoi", Other = "", Lat = 20.9138613, Lng = 105.6266398, Status = true }; context.ContactDetails.Add(contactDetail); context.SaveChanges(); } }
//private void CreateFooter(HLShopDbContext context) //{ // if (context.Footers.Count(x => x.ID == CommonConstants.DefaultFooterId) == 0) // { // string content = ""; // } //} private void CreateSlide(HLShopDbContext 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/bag.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>" }, 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(); } }
public ApplicationUserStore(HLShopDbContext context) : base(context) { }
public HLShopDbContext Init() { return(dbContext ?? (dbContext = new HLShopDbContext())); }