HTTP GET Action Method with parameter of System.Type

67 Views Asked by At

I have the following action method

public PartialViewResult AddToBasket(int id, Type type)
{
    _basketService.AddToBasket(id, type);
    return UpdateBasket();
}

In one of my razor views I am rendering a link like this

@Ajax.ActionLink("Add Box To Basket", "AddToBasket", "Basket", new {id = box.Id, type = typeof(BasketBox)}, new AjaxOptions {UpdateTargetId = "basket", OnSuccess = "showPopover();"}, new {})

This renders a link like this

http://localhost:37913/Public/Basket/AddToBasket/241415?type=MyProject.Shared.Repository.Models.BasketBox

However when AddToBasket is called, my type parameter is always null.

Is this even possible ?

0

There are 0 best solutions below