title: How to use a tuple in an asp.net mvc view?
body: <p>I have the following controller:</p>
  
  <pre><code> public class ModuleController : Controller
      {
          // GET: Modulo
          public ActionResult GetModules()
          {
              return PartialView(Module.GetModulesForUser(ClaimsPrincipal.Current.Identities.First().Name));
          }
      }
  </code></pre>
  
  <p>and this returns the modules for a user</p>
  
  <pre><code>  /// &lt;summary&gt;
          /// Gets the modules activated for a user
          /// &lt;/summary&gt;
          /// &lt;returns&gt;List of modules for the selected user&lt;/returns&gt;
          public static Tuple&lt;string, List&lt;Modulo&gt;&gt; GetModulesForUser(string identityname)
          {
              // It needs to be cached for every user because every user can have different modules enabled.
              var cachekeyname = "ApplicationModulesPerUser|" + identityname;
  
              var cache = CacheConnectionHelper.Connection.GetDatabase();
              Tuple&lt;string, List&lt;Modulo&gt;&gt; modulosPorUsuarioDeDirectorioActivo;
  
              //get object from cache
              string modulosUsuariosString = cache.StringGet(cachekeyname);
              //string modulosUsuariosString;
              if (!string.IsNullOrEmpty(modulosUsuariosString))
              {
                  modulosPorUsuarioDeDirectorioActivo = JsonConvert.DeserializeObject&lt;Tuple&lt;string, List&lt;Modulo&gt;&gt;&gt;(modulosUsuariosString);
                  return modulosPorUsuarioDeDirectorioActivo;
              }
  
              var extPropLookupNameModulos = $"extension_{SettingsHelper.ClientId.Replace("-", "")}_{"Modulos"}";
              var client = AuthenticationHelper.GetActiveDirectoryClient();
              var user = client.Users.GetByObjectId(identityname).ExecuteAsync().Result;
              var userFetcher = (User)user;
              var unitOfWork = new UnitOfWork();
              var keyvaluepairModulos = userFetcher.GetExtendedProperties().FirstOrDefault(prop =&gt; prop.Key == extPropLookupNameModulos);
              var idsModulos = keyvaluepairModulos.Value.ToString().Split(',');
              var listaModulos= idsModulos.Select(idModulo =&gt; unitOfWork.ModuloRepository.GetById(Convert.ToInt32(idModulo))).ToList();
              modulosPorUsuarioDeDirectorioActivo = new Tuple&lt;string, List&lt;Modulo&gt;&gt; ( identityname, listaModulos);
              //convert object to json string
              modulosUsuariosString = JsonConvert.SerializeObject(modulosPorUsuarioDeDirectorioActivo);
              //save string in cache
              cache.StringSet(cachekeyname, modulosUsuariosString, TimeSpan.FromMinutes(SettingsHelper.CacheModuleNames));
              return modulosPorUsuarioDeDirectorioActivo;
          }
  </code></pre>
  
  <p>However I need in the partial view to be able to access the Tuple and then render it.</p>
  
  <pre><code>model Tuple&lt;string,List&lt;xx.Models.GlobalAdmin.Models.Modulo&gt;;
  
  @foreach (var module in Model.Modules)
  {
      &lt;i class="fa @(@module.ClaseFontAwesome)" title="@module.Nombre"&gt;&lt;/i&gt;
  }
  </code></pre>
  
  <p>However I get this error:
  <a href="https://i.stack.imgur.com/G9aUN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/G9aUN.png" alt="http://screencast.com/t/lMDg2IYc"></a></p>