Exemplo n.º 1
0
 private void CreateContactDetail(WebLaptopDbContext context)
 {
     if (context.ContactDetails.Count() == 0)
     {
         try
         {
             var contactdetail = new ContactDetail()
             {
                 Name    = "CNLTTH Thi mùng 5 tháng 1",
                 Address = "Học viện kỹ thuật quân sự",
                 Email   = "*****@*****.**",
                 Lat     = 21.0474076,
                 Lng     = 105.7855591,
                 Phone   = "0383729419",
                 Website = "https://www.facebook.com/profile.php?id=100007755821621",
                 Others  = "",
                 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}\"");
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
        //private void CreateFooter(WebLaptopDbContext context)
        //{
        //    if (context.Footers.Count(x => x.ID == CommonConstants.DefaultFooterId) == 0)
        //    {
        //        string content = "";
        //    }
        //}

        private void CreateSlide(WebLaptopDbContext context)
        {
            if (context.Slides.Count() == 0)
            {
                List <Slide> slides = new List <Slide>()
                {
                    new Slide()
                    {
                        Name = "slide1", 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 = "slide2", 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(slides);
                context.SaveChanges();
            }
        }
Exemplo n.º 3
0
 private void CreatePage(WebLaptopDbContext context)
 {
     if (context.Pages.Count() == 0)
     {
         var page = new Page()
         {
             Name    = "Giới thiệu",
             Alias   = "gioi-thieu",
             Content = @"HỘ KINH DOANH NGUYỄN DANH THÁI
                         236 HOÀNG QUỐC VIỆT
                         Thành phố Hà Nội,
                         Việt Nam
                         SĐT: 0246.2544.533 - Email: contact @laptop88.vn
                         Website: laptop88.vn
                         Số ĐKKD: 0108153788, cấp lần đầu ngày
                         Sở KHĐT TP.Hà Nội cấp",
             Status  = true,
         };
         context.Pages.Add(page);
         context.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public WebLaptopDbContext Init()
 {
     return(dbContext ?? (dbContext = new WebLaptopDbContext()));
 }
Exemplo n.º 5
0
 public ApplicationUserStore(WebLaptopDbContext context)
     : base(context)
 {
 }