mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 11:21:47 -05:00
use .net serializer rather than json.net
This commit is contained in:
parent
556fe967ae
commit
1de8bc4bd0
2 changed files with 17 additions and 6 deletions
|
@ -3,13 +3,24 @@
|
|||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System.Web.Script.Serialization;
|
||||
using Project_Unite.Models;
|
||||
|
||||
namespace Project_Unite.Controllers
|
||||
{
|
||||
public class APIController : Controller
|
||||
{
|
||||
public JavaScriptSerializer Serializer
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
//I'll put those curly braces on their own line just to piss a certain smiley off.
|
||||
|
||||
public APIController()
|
||||
{
|
||||
Serializer = new JavaScriptSerializer();
|
||||
}
|
||||
|
||||
// GET: API
|
||||
public ActionResult Index()
|
||||
{
|
||||
|
@ -26,13 +37,13 @@ public ActionResult Releases(bool showUnstable = false, bool showObsolete = fals
|
|||
if (!showObsolete)
|
||||
releases = releases.Where(x => x.Obsolete == false).ToArray();
|
||||
|
||||
return Content(JsonConvert.SerializeObject(releases));
|
||||
return Content(Serializer.Serialize(releases));
|
||||
}
|
||||
|
||||
public ActionResult Skins()
|
||||
{
|
||||
var db = new ApplicationDbContext();
|
||||
return Content(JsonConvert.SerializeObject(db.Skins.ToArray()));
|
||||
return Content(Serializer.Serialize(db.Skins.ToArray()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -106,9 +106,9 @@
|
|||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>Bin\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Nito.AsyncEx, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Nito.AsyncEx.3.0.1\lib\net45\Nito.AsyncEx.dll</HintPath>
|
||||
|
|
Loading…
Reference in a new issue