// GET: IdentityProvider public ActionResult Index(int?id) { var model = _idpSvc.GetAll().AsQueryable().ProjectTo <IdentityProviderViewModel>().ToList(); return(id != null ? View("Edit", model.Where(m => m.Id == id).FirstOrDefault()) : View(model)); }