public ActionResult Index() { var Repo = new ArticleRepository(Properties.Settings.Default.ConnectionString); var userrepo = new UserRepository(Properties.Settings.Default.ConnectionString); var IndexViewModel = new IndexViewModel(); IndexViewModel.Articles = Repo.GetAllArticls(); if (User.Identity.IsAuthenticated) { IndexViewModel.UserId = userrepo.GetUserByEmail(User.Identity.Name).Id; } return(View(IndexViewModel)); }