mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
parent
56a8613315
commit
2ccf7b5dbe
|
@ -179,6 +179,7 @@
|
|||
<Compile Include="Global.asax.cs">
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\ApiModel\NewBuild.cs" />
|
||||
<Compile Include="Models\ApiModel\SearchResult.cs" />
|
||||
<Compile Include="Models\Build.cs" />
|
||||
<Compile Include="Models\MetaItem.cs" />
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
using System.Web.Http;
|
||||
using BuildFeed.Models;
|
||||
using BuildFeed.Models.ApiModel;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace BuildFeed.Controllers
|
||||
{
|
||||
|
@ -25,6 +26,24 @@ public IEnumerable<string> GetWin10Labs()
|
|||
return labs.GroupBy(l => l).Select(l => l.Key).ToArray();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public bool AddWin10Builds(NewBuild apiModel)
|
||||
{
|
||||
if (apiModel == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Membership.ValidateUser(apiModel.Username, apiModel.Password))
|
||||
{
|
||||
Build.InsertAll(apiModel.NewBuilds);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<SearchResult> GetSearchResult(string query)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(query))
|
||||
|
|
15
Models/ApiModel/NewBuild.cs
Normal file
15
Models/ApiModel/NewBuild.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace BuildFeed.Models.ApiModel
|
||||
{
|
||||
public class NewBuild
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
|
||||
public Build[] NewBuilds { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user