Esempio n. 1
0
        public static void Main()
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<BlogSystemDbContext, Configuration>());
            var data = new BlogSystemDbContext();

            var post = new Post
            {
                Title = "Hi 3 dsadasdasdasdasdasd",
                PostedOn = DateTime.Now,
            };

            data.Posts.Add(post);
            data.SaveChanges();

            var posts = data.Posts.AsQueryable();

            if (true)
            {
                posts = posts.Where(p => p.Title == "gosho");
            }

            if (true)
            {
                posts = posts.Where(p => p.Subtitle == "pesho");
            }

            var result = posts.ToList();
        }
 public ActionResult Post(Post post)
 {
     return AutoMappedObjectView<Post, PostIndexViewModel>(View(post));
 }