public ActionResult <IEnumerable <string> > Index(string username)
        {
            var posts = _context.Posts.ToList();

            long userid = _context.Users.Where(x => x.Username == username).Select(x => x.Id).First();

            Console.WriteLine($"userid is {userid}");
            IEnumerable <Post> UPosts = posts.Where(post => post.UserId == userid);

            Console.WriteLine("In the home controller");
            Profile profile = new Profile(username);

            foreach (var post in UPosts)
            {
                profile.AddPost(new Post
                {
                    Id        = post.Id,
                    UserId    = post.UserId,
                    Content   = post.Content,
                    CreatedOn = post.CreatedOn
                });


                Console.WriteLine(post.Content);
            }
            Console.WriteLine(_context.GetType());
            Console.WriteLine("good morning");
            @ViewData["posts"] = posts;

            return(View(profile));
        }
        public ActionResult <IEnumerable <string> > Index()
        {
            var todoitems = _context.TodoItems.ToList();

            TodoList todoList = new TodoList();

            foreach (var item1 in todoitems)
            {
                todoList.AddItem(new TodoItem {
                    Id = item1.Id, Name = item1.Name, IsComplete = item1.IsComplete
                });

                Console.WriteLine(item1.Name);
            }
            Console.WriteLine(_context.GetType());
            Console.WriteLine("good morning");
            @ViewData["todoItems"] = todoitems;

            return(View(todoList));
        }
        public TodoController(TodoContext context, ICorrelationContextAccessor correlationContext)
        {
            _correlationContext = correlationContext;
            CountDbContext++;
            Console.WriteLine($"TodoController:{CountDbContext}");
            Console.WriteLine();
            context.MyTest = 9;
            System.Console.WriteLine($"DbContextOptions<TodoContext> options==>{context.GetHashCode()} {context.GetType().FullName}");

            var s = Request;

            _context = context;

            if (_context.TodoItems.Count() == 0)
            {
                _context.TodoItems.Add(new TodoItem {
                    Name = "Item1"
                });
                _context.SaveChanges();
            }
        }