mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-02-02 13:07:34 +00: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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Newtonsoft.Json;
|
using System.Web.Script.Serialization;
|
||||||
using Project_Unite.Models;
|
using Project_Unite.Models;
|
||||||
|
|
||||||
namespace Project_Unite.Controllers
|
namespace Project_Unite.Controllers
|
||||||
{
|
{
|
||||||
public class APIController : Controller
|
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
|
// GET: API
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
|
@ -26,13 +37,13 @@ namespace Project_Unite.Controllers
|
||||||
if (!showObsolete)
|
if (!showObsolete)
|
||||||
releases = releases.Where(x => x.Obsolete == false).ToArray();
|
releases = releases.Where(x => x.Obsolete == false).ToArray();
|
||||||
|
|
||||||
return Content(JsonConvert.SerializeObject(releases));
|
return Content(Serializer.Serialize(releases));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Skins()
|
public ActionResult Skins()
|
||||||
{
|
{
|
||||||
var db = new ApplicationDbContext();
|
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>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
<HintPath>Bin\Newtonsoft.Json.dll</HintPath>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Nito.AsyncEx, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\Nito.AsyncEx.3.0.1\lib\net45\Nito.AsyncEx.dll</HintPath>
|
||||||
|
|
Loading…
Add table
Reference in a new issue