AmbiguousMatchException in asp.net mvc 5 c #

0

I have trouble trying to send an id by url, the thing is that this id is being called from a partialview () and I would have to redirect it to another view, but it generates the following exception AmbiguousMatchException.

Here's how I send the id:

http://localhost:52509/TiposAsesores/delete_usuario_grup/18

In the partialview () view, the button where the id is sent is:

<a href="@Url.Action("delete_usuario_grup","TiposAsesores", new { id = item.GrupAsesor})" class="btn btn-danger" title="Eliminar del grupo"><i class="fa fa-trash-o"></i></a>

And so it looks from the browser:

<a href="/TiposAsesores/delete_usuario_grup/18" class="btn btn-danger" title="Eliminar del grupo"><i class="fa fa-trash-o"></i></a>

And this is the action of the controller that receives the id:

public ActionResult delete_usuario_grup(int id)
    {
        Sto_TipoAsesor_Usuario_NE STAUNE = new Sto_TipoAsesor_Usuario_NE();
        Sto_TipoAsesor_Usuario STAU = new Sto_TipoAsesor_Usuario();
        STAU.Id_TipoAsesor_Usuario = id;
        STAU = STAUNE.ListarByID(STAU);
        return View(STAU);
    }

And this is the complete error that I generated when loading the view:

La solicitud actual para la acción 'delete_usuario_grup' en el tipo de controlador 'TiposAsesoresController' es ambigua entre los métodos de acción siguientes: 
System.Web.Mvc.ActionResult delete_usuario_grup(Int32) en el tipo             SistemaDeSeguimientoEstudiantil.Controllers.TiposAsesoresController
System.Web.Mvc.ActionResult delete_usuario_grup(CapaEntidad.Sto_TipoAsesor_Usuario) en el tipo SistemaDeSeguimientoEstudiantil.Controllers.TiposAsesoresController

Someone could advise me on how to solve this error

    
asked by Jhonny Luis 14.05.2018 в 07:21
source

1 answer

0

You have repeated the action you invoke and create ambiguity, look at the microsoft documentation:

  

An AmbiguousMatchException is thrown when a member is invoked late-bound and multiple overloads satisfy the binding criteria, or when more than one member matches the binding criteria passed to a reflection method that can return only to single result (for example, Type .GetMethod or Type.GetProperty).

Translation

  

An AmbiguousMatchException is generated when a member is invoked with a late destination and multiple overloads satisfy the link criteria, or when more than one member matches the link criteria passed to a reflection method that can return only one result (for example, Type.GetMethod or Type.GetProperty).

link

    
answered by 14.05.2018 в 10:12