public RedirectToRouteResult AddToQueryBag(QueryBag queryBag ,int queryId, string returnUrl) { //place GW2 Api query code here //Placeholder variable QueryResult resultToAdd = new QueryResult() {QueryId = queryId }; queryBag.AddQueryResult(resultToAdd); return RedirectToAction("Index", new {returnUrl}); }
public void AddQueryResult(QueryResult result) { //Check if there is a Query with that Id in the list and replace it int index = queryResults.FindIndex(q => q.QueryId == result.QueryId); if (index >= 0) { queryResults.RemoveAt(index); queryResults.Insert(index, result); } else { queryResults.Add(result); } }