Error in the configuration of MapRoute

0

The following error is returned to me:

  

The parameters dictionary contains a null entry for parameter 'numerodeserie' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Equipment (System.String, System.String, Int32, Int32)' in 'SCO.Controllers.EquipmentsController'

The configuration of my MapRoute, I do it this way:

routes.MapRoute(
 name: "EquipamentosTrafego",
 url: "Equipamentos/{cidadecod}/{contratocod}/Trafego/{filtro}",
 defaults: new
 {
    controller = "Equipamentos",
    action = "EquipamentosTrafego"
 }
 );

And in my View I try to access it this way:

<td align="center">
<div class="list-group-item">
     <a href="/Equipamentos/@item.cidadecod/@item.contratocod/Trafego/OFF">
           <span class="badge" style="font-size: 18px; background-color:@item.totaleqpson_stts">@item.totaleqpson</span>
     </a>
</div>

What's wrong?

    
asked by anonymous 25.08.2016 / 13:37

1 answer

0

Solved. I had another MapRoute configured that was being referenced. I put this MapRoute after the new MapRoute:

routes.MapRoute(
       name: "EquipamentosTrafego",
       url: "Equipamentos/{cidadecod}/{contratocod}/Trafego/{filtro}",
       defaults: new
       {
           controller = "Equipamentos",
           action = "EquipamentosTrafego"
       }
       );

Conflicting MapRoute, placed later:

routes.MapRoute(
      name: "Equipamento",
      url: "Equipamentos/{cidadecod}/{contratocod}/{numerodeserie}/{faixa}",
      defaults: new
      {
          controller = "Equipamentos",
          action = "Equipamento"
      }
      );
    
25.08.2016 / 20:34