diff --git a/AIParkingApplication/ApiController.cs b/AIParkingApplication/ApiController.cs index d22c665..06256de 100644 --- a/AIParkingApplication/ApiController.cs +++ b/AIParkingApplication/ApiController.cs @@ -120,6 +120,26 @@ namespace AIParkingApplication } } + public async Task CheckCard(string cardNumber) + { + try + { + var request = new CardInfo() + { + CardNumber = cardNumber + }; + HttpResponseMessage response = await httpClient.PostAsJsonAsync("/api/check-card", request); + response.EnsureSuccessStatusCode(); + var cardValication = await response.Content.ReadAsAsync(); + return cardValication; + } + catch (Exception ex) + { + Console.WriteLine($"SendCheckCardRequest : {ex.Message}"); + return new CardValidation(); + } + } + //Neu Dicrection la Out thi logID la logID lay ve khi check the public async Task SaveLog(int direction, string cardID, string cameraID, int squareOrLong, string timeInOrOut, string textPlate, Mat plateImage, Mat plateImageResult, Mat PlateFrameImage, Mat FrameImage, string logID = "") { @@ -166,6 +186,57 @@ namespace AIParkingApplication } } + public class CardInfo + { + [JsonProperty("card")] + public string CardNumber { get; set; } + } + + public class CardValidation + { + [JsonProperty("status")] + public string IsValid { get; set; } + + [JsonProperty("type")] + public string Direction { get; set; } + + [JsonProperty("cardID")] + public string CardIP { get; set; } + + [JsonProperty("cardRealID")] + public int CardRealID { get; set; } + + [JsonProperty("log_id")] + public int LogID { get; set; } + + [JsonProperty("cardType")] + public string CardType { get; set; } + + [JsonProperty("vehicleType")] + public string VehicleType { get; set; } + + [JsonProperty("autoOpen")] + public bool AutoOpenDoor { get; set; } + + [JsonProperty("plate")] + public string Plate { get; set; } + + [JsonProperty("time")] + public string TimeIn { get; set; } + + [JsonProperty("plateImage")] + public string PlateImageBase64 { get; set; } + + [JsonProperty("frameImage")] + public string FrameImageBase64 { get; set; } + + [JsonProperty("faceImage")] + public string FaceImageBase64 { get; set; } + + [JsonProperty("name")] + public string CustomerName { get; set; } + } + public class SaveLogRespone { [JsonProperty("status")]