mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-02-02 13:07:34 +00:00
Begin work on Unite API.
This commit is contained in:
parent
eca15c91f8
commit
4e0948aa19
2 changed files with 44 additions and 0 deletions
38
Project-Unite/Controllers/APIController.cs
Normal file
38
Project-Unite/Controllers/APIController.cs
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Project_Unite.Models;
|
||||||
|
|
||||||
|
namespace Project_Unite.Controllers
|
||||||
|
{
|
||||||
|
public class APIController : Controller
|
||||||
|
{
|
||||||
|
// GET: API
|
||||||
|
public ActionResult Index()
|
||||||
|
{
|
||||||
|
return Content("Please use a valid API endpoint.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult Releases(bool showUnstable = false, bool showObsolete = false)
|
||||||
|
{
|
||||||
|
var db = new ApplicationDbContext();
|
||||||
|
|
||||||
|
var releases = db.Downloads.ToArray();
|
||||||
|
if (!showUnstable)
|
||||||
|
releases = releases.Where(x => x.IsStable == true).ToArray();
|
||||||
|
if (!showObsolete)
|
||||||
|
releases = releases.Where(x => x.Obsolete == false).ToArray();
|
||||||
|
|
||||||
|
return Content(JsonConvert.SerializeObject(releases));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult Skins()
|
||||||
|
{
|
||||||
|
var db = new ApplicationDbContext();
|
||||||
|
return Content(JsonConvert.SerializeObject(db.Skins.ToArray()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -106,6 +106,10 @@
|
||||||
<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">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>Bin\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</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>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
|
@ -238,6 +242,7 @@
|
||||||
<Compile Include="App_Start\Startup.Auth.cs" />
|
<Compile Include="App_Start\Startup.Auth.cs" />
|
||||||
<Compile Include="Controllers\AccountController.cs" />
|
<Compile Include="Controllers\AccountController.cs" />
|
||||||
<Compile Include="Controllers\AdminController.cs" />
|
<Compile Include="Controllers\AdminController.cs" />
|
||||||
|
<Compile Include="Controllers\APIController.cs" />
|
||||||
<Compile Include="Controllers\DeveloperController.cs" />
|
<Compile Include="Controllers\DeveloperController.cs" />
|
||||||
<Compile Include="Controllers\DownloadController.cs" />
|
<Compile Include="Controllers\DownloadController.cs" />
|
||||||
<Compile Include="Controllers\ForumController.cs" />
|
<Compile Include="Controllers\ForumController.cs" />
|
||||||
|
@ -553,6 +558,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="App_Data\" />
|
<Folder Include="App_Data\" />
|
||||||
<Folder Include="Properties\PublishProfiles\" />
|
<Folder Include="Properties\PublishProfiles\" />
|
||||||
|
<Folder Include="Views\API\" />
|
||||||
<Folder Include="Views\WikiController\" />
|
<Folder Include="Views\WikiController\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Loading…
Add table
Reference in a new issue