diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Service1.cs b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Service1.cs index f1375da..6f3b5fb 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Service1.cs +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Service1.cs @@ -1,15 +1,9 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Linq; using System.Net; using System.Net.Http; using System.ServiceProcess; -using System.Text; using System.Threading; -using System.Threading.Tasks; using System.Web.Http; using DalSoft.WebApi.HelpPage; using Microsoft.Owin.FileSystems; @@ -77,14 +71,16 @@ namespace WindowsDataCenter public void Configuration(IAppBuilder appBuilder) { var config = new HttpConfiguration(); + config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); - appBuilder.UseWebApi(config); + appBuilder.UseWebApi(config); + #if DEBUG //Add the help-pages extension only in Debug mode. appBuilder.UseWebApiHelpPage(config, "help-pages"); @@ -117,6 +113,32 @@ namespace WindowsDataCenter var respMsg = new HttpResponseMessage(HttpStatusCode.OK); return ResponseMessage(respMsg); } + + /// + /// Get unassigned card Ids in the system. + /// + /// Json object containing list of unassigned card objects + /// + /// > Get: http://{baseaddress}:port/api/swipedata/unassigned + /// > Returns: + /// { + /// "data": [ + /// { + /// "id": 0, + /// "Id": 0, + /// "UserId": -1, + /// "IsSelected": false, + /// "CardUId": "39c6ec38-3879-4ee6-99ae-0a55777f6b86" + /// } + /// ] + /// } + /// + [HttpGet] + [Route("api/swipedata/unassigned")] + public IHttpActionResult GetUnassignedCards() + { + throw new NotImplementedException(); + } } public class ValuesController : ApiController @@ -127,28 +149,6 @@ namespace WindowsDataCenter } } - public class RouteController : ApiController - { - public IHttpActionResult Get() - { - List routeList = new List(); - var routes = GlobalConfiguration.Configuration.Routes; - foreach (var route in routes) - { - var obj = new RouteObject(); - obj.RouteUrl = route.RouteTemplate; - routeList.Add(obj); - } - - return Json(routeList); - } - - class RouteObject - { - public string RouteUrl { get; set; } - } - } - public class UsersController : ApiController { public IHttpActionResult GetUsers()