diff --git a/Branch.App/Controllers/SearchController.cs b/Branch.App/Controllers/SearchController.cs
index 7239ebd2..3abd3631 100644
--- a/Branch.App/Controllers/SearchController.cs
+++ b/Branch.App/Controllers/SearchController.cs
@@ -1,4 +1,5 @@
using System;
+using System.Web;
using System.Web.Mvc;
using Branch.App.Models;
@@ -11,13 +12,13 @@ public class SearchController : Controller
public ActionResult Index(string q)
{
if (String.IsNullOrEmpty(q))
- throw new ArgumentException("yo, query can't be null/empty");
+ throw new HttpException(404, "yo, query can't be null/empty");
// find halo 4 players
- var halo4ServiceRecord = GlobalStorage.H4Manager.GetPlayerServiceRecord(q);
+ var halo4ServiceRecord = GlobalStorage.H4Manager.GetPlayerServiceRecord(q, true);
// find halo reach players
- var haloReachServiceRecord = GlobalStorage.HReachManager.GetPlayerServiceRecord(q);
+ var haloReachServiceRecord = GlobalStorage.HReachManager.GetPlayerServiceRecord(q, true);
// le render le model le
return View(new SearchViewModel(q, halo4ServiceRecord, haloReachServiceRecord));
diff --git a/Branch.App/Web.config b/Branch.App/Web.config
index c1e9fdb3..55c29b2e 100644
--- a/Branch.App/Web.config
+++ b/Branch.App/Web.config
@@ -33,6 +33,11 @@
+
+
+
+
+
diff --git a/Branch.Azure/ServiceDefinition.csdef b/Branch.Azure/ServiceDefinition.csdef
index d93faf78..4dd15a50 100644
--- a/Branch.Azure/ServiceDefinition.csdef
+++ b/Branch.Azure/ServiceDefinition.csdef
@@ -9,12 +9,13 @@
+
-
+
@@ -33,6 +34,7 @@
+
diff --git a/Branch.Core.Game.Halo4/Api/Manager.cs b/Branch.Core.Game.Halo4/Api/Manager.cs
index 6dbc88f6..23ff4f50 100644
--- a/Branch.Core.Game.Halo4/Api/Manager.cs
+++ b/Branch.Core.Game.Halo4/Api/Manager.cs
@@ -135,8 +135,9 @@ public void GetChallenges()
/// Gets a Players Halo 4 Service Record
///
/// The players Xbox 360 Gamertag.
+ /// Tries to take the cached version. If no cached version is avaiable, gets from server.
/// The raw JSON of their Service Record
- public ServiceRecord GetPlayerServiceRecord(string gamertag)
+ public ServiceRecord GetPlayerServiceRecord(string gamertag, bool takeCachedVersion = false)
{
const BlobType blobType = BlobType.PlayerServiceRecord;
var escapedGamertag = EscapeGamertag(gamertag);
@@ -147,6 +148,10 @@ public ServiceRecord GetPlayerServiceRecord(string gamertag)
// Check if blob exists & expire date
if (blobValidity.Item1) return blobValidity.Item2;
+ // Do we take the cached version?
+ if (takeCachedVersion && blobValidity.Item2 != null)
+ return blobValidity.Item2;
+
// Try and get new blob
var url = PopulateUrl(UrlFromIds(EndpointType.ServiceList, "GetServiceRecord"),
new Dictionary {{"gamertag", gamertag}});
diff --git a/Branch.Core.Game.HaloReach/Api/Manager.cs b/Branch.Core.Game.HaloReach/Api/Manager.cs
index 6bc0b707..8948224b 100644
--- a/Branch.Core.Game.HaloReach/Api/Manager.cs
+++ b/Branch.Core.Game.HaloReach/Api/Manager.cs
@@ -64,8 +64,9 @@ public void GetMetadata()
/// Gets a Players Halo: Reach Service Record
///
/// The players Xbox 360 Gamertag.
+ /// Tries to take the cached version. If no cached version is avaiable, gets from server.
/// Retuens a model.
- public ServiceRecord GetPlayerServiceRecord(string gamertag)
+ public ServiceRecord GetPlayerServiceRecord(string gamertag, bool takeCachedVersion = false)
{
const BlobType blobType = BlobType.PlayerServiceRecord;
var escapedGamertag = EscapeGamertag(gamertag);
@@ -76,6 +77,10 @@ public ServiceRecord GetPlayerServiceRecord(string gamertag)
// Check if blob exists & expire date
if (blobValidity.Item1) return blobValidity.Item2;
+ // Do we take the cached version?
+ if (takeCachedVersion && blobValidity.Item2 != null)
+ return blobValidity.Item2;
+
// Try and get new blob
var endpoint = String.Format("player/details/byplaylist/{0}/{1}", ApiKey, gamertag);
var serviceRecordRaw = ValidateResponseAndGetRawText(UnauthorizedRequest(endpoint));