ApiController - Refactoring abit
This commit is contained in:
parent
7b05cbafa2
commit
57101b4d8f
|
@ -39,7 +39,7 @@ namespace AIParkingApplication
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SendEngineRequest : {ex.Message}");
|
Console.WriteLine($"Login Exception:\t{DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)} \t {ex.Message}");
|
||||||
return new LoginDataModel
|
return new LoginDataModel
|
||||||
{
|
{
|
||||||
IsLoginSuccess = false
|
IsLoginSuccess = false
|
||||||
|
@ -53,21 +53,22 @@ namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
HttpResponseMessage response = await httpClient.GetAsync("/api/statistics");
|
HttpResponseMessage response = await httpClient.GetAsync("/api/statistics");
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
Statistic.ParkInfo parkInfo = await response.Content.ReadAsAsync<Statistic.ParkInfo>();
|
Statistic.ParkInfo parkingInfo = await response.Content.ReadAsAsync<Statistic.ParkInfo>();
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(parkInfo.TotalIn))
|
if (string.IsNullOrEmpty(parkingInfo.TotalIn))
|
||||||
{
|
{
|
||||||
parkInfo.TotalIn = "0";
|
parkingInfo.TotalIn = "0";
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(parkInfo.TotalOut))
|
|
||||||
|
if (string.IsNullOrEmpty(parkingInfo.TotalOut))
|
||||||
{
|
{
|
||||||
parkInfo.TotalOut = "0";
|
parkingInfo.TotalOut = "0";
|
||||||
}
|
}
|
||||||
return parkInfo;
|
return parkingInfo;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SendApiStatisticRequest : {ex.Message}");
|
Console.WriteLine($"GetStatisticInfo Exception:\t{DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)} \t {ex.Message}");
|
||||||
return new Statistic.ParkInfo();
|
return new Statistic.ParkInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,7 +88,7 @@ namespace AIParkingApplication
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SendCheckCardRequest : {ex.Message}");
|
Console.WriteLine($"CheckCard Exception:\t{DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)} \t {ex.Message}");
|
||||||
return new CardValidation();
|
return new CardValidation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +124,7 @@ namespace AIParkingApplication
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SendSaveLogRequest : {ex.Message}");
|
Console.WriteLine($"SaveLog Exception:\t{DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)} \t {ex.Message}");
|
||||||
return new SaveLogRespone();
|
return new SaveLogRespone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +138,8 @@ namespace AIParkingApplication
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#region Check card validation API
|
|
||||||
|
#region Check card validation API Data Model
|
||||||
public class CardModel
|
public class CardModel
|
||||||
{
|
{
|
||||||
[JsonProperty("card")]
|
[JsonProperty("card")]
|
||||||
|
@ -190,8 +192,7 @@ namespace AIParkingApplication
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Save Log API Data Model
|
||||||
#region Save Log API
|
|
||||||
public class SaveLogRespone
|
public class SaveLogRespone
|
||||||
{
|
{
|
||||||
[JsonProperty("status")]
|
[JsonProperty("status")]
|
||||||
|
@ -241,8 +242,7 @@ namespace AIParkingApplication
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Get Config API Data Model
|
||||||
#region Get Config API
|
|
||||||
public class LoginModel
|
public class LoginModel
|
||||||
{
|
{
|
||||||
[JsonProperty("username")]
|
[JsonProperty("username")]
|
||||||
|
@ -310,8 +310,6 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
[JsonProperty("laneConfig")]
|
[JsonProperty("laneConfig")]
|
||||||
public LaneConfig LaneConfigData { get; set; }
|
public LaneConfig LaneConfigData { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region API Path
|
#region API Path
|
||||||
|
@ -331,7 +329,6 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
[JsonProperty("apiUpdateLogs")]
|
[JsonProperty("apiUpdateLogs")]
|
||||||
public APIProperties ApiUpdateLogs { get; set; }
|
public APIProperties ApiUpdateLogs { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class APIProperties
|
public class APIProperties
|
||||||
|
@ -351,54 +348,73 @@ namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
[JsonProperty("id")]
|
[JsonProperty("id")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
[JsonProperty("gate")]
|
[JsonProperty("gate")]
|
||||||
public int Gate { get; set; }
|
public int Gate { get; set; }
|
||||||
|
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[JsonProperty("type")]
|
[JsonProperty("type")]
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
||||||
[JsonProperty("stream_url")]
|
[JsonProperty("stream_url")]
|
||||||
public string Stream_url { get; set; }
|
public string Stream_url { get; set; }
|
||||||
|
|
||||||
[JsonProperty("minWidth")]
|
[JsonProperty("minWidth")]
|
||||||
public double MinWidth { get; set; }
|
public double MinWidth { get; set; }
|
||||||
|
|
||||||
[JsonProperty("maxWidth")]
|
[JsonProperty("maxWidth")]
|
||||||
public double MaxWidth { get; set; }
|
public double MaxWidth { get; set; }
|
||||||
|
|
||||||
[JsonProperty("minHeight")]
|
[JsonProperty("minHeight")]
|
||||||
public double MinHeight { get; set; }
|
public double MinHeight { get; set; }
|
||||||
|
|
||||||
[JsonProperty("maxHeight")]
|
[JsonProperty("maxHeight")]
|
||||||
public double MaxHeight { get; set; }
|
public double MaxHeight { get; set; }
|
||||||
|
|
||||||
[JsonProperty("scaleFactor")]
|
[JsonProperty("scaleFactor")]
|
||||||
public double ScaleFactor { get; set; }
|
public double ScaleFactor { get; set; }
|
||||||
|
|
||||||
[JsonProperty("minNeighbors")]
|
[JsonProperty("minNeighbors")]
|
||||||
public double MinNeighbors { get; set; }
|
public double MinNeighbors { get; set; }
|
||||||
|
|
||||||
[JsonProperty("status")]
|
[JsonProperty("status")]
|
||||||
public double Status { get; set; }
|
public double Status { get; set; }
|
||||||
|
|
||||||
[JsonProperty("isRecognizeCamera")]
|
[JsonProperty("isRecognizeCamera")]
|
||||||
public bool IsRecognizeCamera { get; set; }
|
public bool IsRecognizeCamera { get; set; }
|
||||||
|
|
||||||
[JsonProperty("isLongPlate")]
|
[JsonProperty("isLongPlate")]
|
||||||
public bool IsLongPlate { get; set; }
|
public bool IsLongPlate { get; set; }
|
||||||
|
|
||||||
[JsonProperty("stt")]
|
[JsonProperty("stt")]
|
||||||
public int Stt { get; set; }
|
public int Stt { get; set; }
|
||||||
|
|
||||||
[JsonProperty("roi_config")]
|
[JsonProperty("roi_config")]
|
||||||
public string Roi_config { get; set; }
|
public string Roi_config { get; set; }
|
||||||
|
|
||||||
[JsonProperty("created_at")]
|
[JsonProperty("created_at")]
|
||||||
public int Created_at { get; set; }
|
public int Created_at { get; set; }
|
||||||
|
|
||||||
[JsonProperty("modified_at")]
|
[JsonProperty("modified_at")]
|
||||||
public int Modified_at { get; set; }
|
public int Modified_at { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Statistics
|
public class Statistics
|
||||||
{
|
{
|
||||||
[JsonProperty("moto")]
|
[JsonProperty("moto")]
|
||||||
public string Moto { get; set; }
|
public string Moto { get; set; }
|
||||||
|
|
||||||
[JsonProperty("oto")]
|
[JsonProperty("oto")]
|
||||||
public string Oto { get; set; }
|
public string Oto { get; set; }
|
||||||
|
|
||||||
[JsonProperty("vip")]
|
[JsonProperty("vip")]
|
||||||
public string Vip { get; set; }
|
public string Vip { get; set; }
|
||||||
|
|
||||||
[JsonProperty("total_in")]
|
[JsonProperty("total_in")]
|
||||||
public string Total_in { get; set; }
|
public string Total_in { get; set; }
|
||||||
|
|
||||||
[JsonProperty("total_out")]
|
[JsonProperty("total_out")]
|
||||||
public string Total_out { get; set; }
|
public string Total_out { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -476,6 +492,7 @@ namespace AIParkingApplication
|
||||||
public bool IsLongPlate { get; set; }
|
public bool IsLongPlate { get; set; }
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user