public IndexModel(ProjectBlogger.Data.BloggerContext context)
 {
     _context = context;
 }
Пример #2
0
 public CreateModel(ProjectBlogger.Data.BloggerContext context)
 {
     _context = context;
 }
 public DetailsModel(ProjectBlogger.Data.BloggerContext context)
 {
     _context = context;
 }
        public static void Initialize(BloggerContext context)
        {
            context.Database.EnsureCreated();

            ////Look for any MyBlogs(plural).
            //if (context.MyBlogss.Any())
            //    {
            //        return;   // DB has been seeded
            //    }

            ////this hasn't worked for some reason!

            //var myBlogss = new MyBlogs[]
            //{
            //    new MyBlogs{
            //        BlogName = "How to Code",
            //        Description = "This is the short Description",
            //        ActualBlog  = "This will be the Blog content",
            //        ImageUrl = "https://cdn.wearecodenation.com/app/uploads/Dan.jpg",
            //        ThumbUrl = "https://cdn.wearecodenation.com/app/uploads/Dan.jpg",
            //        BlogOfTheWeek = true,
            //        UserID = 2
            //        },
            //     new MyBlogs{
            //        BlogName = "How NOT to Code",
            //        Description = "This is the short Description",
            //        ActualBlog = "This will be the Blog content",
            //        ImageUrl = "https://cdn.wearecodenation.com/app/uploads/Dan.jpg",
            //        ThumbUrl = "https://cdn.wearecodenation.com/app/uploads/Dan.jpg",
            //        BlogOfTheWeek = false,
            //        UserID = 2
            //        },
            //     new MyBlogs{
            //        BlogName = "Do you know how to Code?",
            //        Description = "This is the short Description",
            //        ActualBlog = "This will be the Blog content",
            //        ImageUrl = "https://cdn.wearecodenation.com/app/uploads/Dan.jpg",
            //        ThumbUrl = "https://cdn.wearecodenation.com/app/uploads/Dan.jpg",
            //        BlogOfTheWeek = false,
            //        UserID = 2
            //        },
            //};

            //foreach (MyBlogs b in myBlogss)
            //{
            //    context.MyBlogss.Add(b);
            //}
            //context.SaveChanges();


            //var users = new User[]
            //{
            //    new User{
            //    FirstName = "Jody",
            //    LastName = "Richardson",
            //    UserName = "******",
            //    Email = "*****@*****.**",
            //    Password = "******"
            //    },
            //    new User{
            //    FirstName = "Heather",
            //    LastName = "Smith",
            //    UserName = "******",
            //    Email = "*****@*****.**",
            //    Password = "******"
            //    },
            //     new User{
            //    FirstName = "Hammad",
            //    LastName = "Ali",
            //    UserName = "******",
            //    Email = "*****@*****.**",
            //    Password = "******"
            //    },
            //};
            //foreach (User u in users)
            //{
            //    context.Users.Add(u);
            //}
            //context.SaveChanges();
        }
Пример #5
0
 public EditModel(ProjectBlogger.Data.BloggerContext context)
 {
     _context = context;
 }