Error in Maproute configuration

Asked

Viewed 17 times

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 so:

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 that 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 is wrong ?

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"
       }
       );

Maproute that gave conflict, placed after:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.