changed api method to use the return type of IRepository.LogEventTime method and return the Id and Direction from the endpoint.
#17
This commit is contained in:
parent
c92ed064fc
commit
3446dda710
@ -14,10 +14,12 @@ namespace WindowsDataCenter
|
||||
{
|
||||
private readonly IRepository _repo;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="repo"></param>
|
||||
/// <param name="logger"></param>
|
||||
public SwipeDataController(IRepository repo, ILogger logger)
|
||||
{
|
||||
if(repo == null) throw new ArgumentNullException(nameof(repo));
|
||||
@ -36,13 +38,10 @@ namespace WindowsDataCenter
|
||||
public IHttpActionResult PostData([FromBody] CardData cData)
|
||||
{
|
||||
int logId;
|
||||
_repo.LogEventTime(new Identifier {UniqueId = cData.CardUId}, out logId);
|
||||
_logger.Trace("Received new \"Swipe Event\" for UId: {0} at {1}", cData.CardUId, DateTime.UtcNow);
|
||||
return
|
||||
ResponseMessage(new HttpResponseMessage(HttpStatusCode.OK)
|
||||
{
|
||||
Content = new StringContent(logId.ToString())
|
||||
});
|
||||
var resp = _repo.LogEventTime(new Identifier {UniqueId = cData.CardUId}, out logId);
|
||||
_logger.Trace("Received new \"Swipe Event\" for UId: {0} at {1}, direction is : {2}", cData.CardUId,
|
||||
DateTime.UtcNow, resp.Direction);
|
||||
return Ok(new {Id = logId, resp.Direction});
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user