Wednesday, 7 August 2013

Is it possible to pass a Session variable (object) to an API as a parameter?

Is it possible to pass a Session variable (object) to an API as a parameter?

I have a web page with a search criteria.
Once the user selects what he wants and inputs any keywords to search, he
is re-directed to another page which shows the results of his search.
This session object contains all of the information of his search:
var ProjectSearchCriteria = (GBLProjectSearchCriteria)
Session[GblConstants.SESSION_PROJECT_SEARCH_CRITERIA];
Is there a way for me to pass this object to an API?
Like so:
[HttpGet]
public List<string> getEpisodes(GBLProjectSearchCriteria psc)
{
var ProjectSearchResult = new ProjectSearchResultController();
var GBLProjectSearchResultListData =
ProjectSearchResult.GetProjectSearchResultList(psc);
return (from GBLProjectSearchResult item
in GBLProjectSearchResultListData
select item.Title).ToList();
}
The reason why I want to do this is because the search criteria is massive
and it already exists so I don't want the API to have 38032823 parameters.
Is this even possible? How would I do it? Any alternatives?

No comments:

Post a Comment