From 34b427293a4e06801b59eea3f35ed808bde25b4c Mon Sep 17 00:00:00 2001 From: "chris.watts90@outlook.com" Date: Wed, 8 Feb 2017 22:26:33 +0000 Subject: [PATCH] return the new Id of the created time log event. tidied code too. --- .../Controllers/SwipeDataController.cs | 32 ++----------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Controllers/SwipeDataController.cs b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Controllers/SwipeDataController.cs index 3e5bc87..b2230de 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Controllers/SwipeDataController.cs +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/Controllers/SwipeDataController.cs @@ -20,38 +20,12 @@ namespace WindowsDataCenter [Route("")] public IHttpActionResult PostData([FromBody] CardData cData) { - //var cardIdQuery = _connection.Query( - // "select * from CardUniqueIds where CardUId = ?", - // cData.CardUId); - - //var userId = 0; - //if (!cardIdQuery.Any()) - //{ - // //new card, create it! - // userId = _connection.Insert(new CardUniqueId() - // { - // UserId_FK = -1, - // CardUId = cData.CardUId - // }); - //} - //else - //{ - // userId = cardIdQuery.First().UserId_FK; - //} - - //var timeLog = new TimeLog - //{ - // SwipeEventDateTime = DateTime.UtcNow, - // UserId_FK = userId - //}; - - //var tLogId = _connection.Insert(timeLog); - //TODO: TEST - _repo.LogEventTime(new Identifier {UniqueId = cData.CardUId}); + int logId; + _repo.LogEventTime(new Identifier {UniqueId = cData.CardUId}, out logId); return ResponseMessage(new HttpResponseMessage(HttpStatusCode.OK) { - Content = new StringContent("TODO: return ID") + Content = new StringContent(logId.ToString()) }); }