diff --git a/BuildFeed.csproj b/BuildFeed.csproj index 6f9e50c..0156935 100644 --- a/BuildFeed.csproj +++ b/BuildFeed.csproj @@ -179,6 +179,7 @@ Global.asax + diff --git a/Controllers/apiController.cs b/Controllers/apiController.cs index 7ccaf48..b91e39b 100644 --- a/Controllers/apiController.cs +++ b/Controllers/apiController.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 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 GetSearchResult(string query) { if (string.IsNullOrWhiteSpace(query)) diff --git a/Models/ApiModel/NewBuild.cs b/Models/ApiModel/NewBuild.cs new file mode 100644 index 0000000..afacee8 --- /dev/null +++ b/Models/ApiModel/NewBuild.cs @@ -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; } + } +} \ No newline at end of file