SmallRefactor: Bỏ check object {Vehicle} null khi gán giá trị

This commit is contained in:
Le Chau 2020-06-25 10:29:24 +07:00
parent cdc5ffb968
commit bc86b4c00f

View File

@ -44,19 +44,19 @@ namespace AIParkingApplication
HttpResponseMessage response = await client.GetAsync("/api/statistics"); HttpResponseMessage response = await client.GetAsync("/api/statistics");
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
var vehicle = await response.Content.ReadAsAsync<Vehicle>(); var vehicle = await response.Content.ReadAsAsync<Vehicle>();
lblSoLuongXeMay?.Invoke(new Action(() => lblSoLuongXeMay.Invoke(new Action(() =>
{ {
lblSoLuongXeMay.Text = vehicle.NumberOfMoto.ToString(); lblSoLuongXeMay.Text = vehicle.NumberOfMoto.ToString();
})); }));
lblSoLuongOto?.Invoke(new Action(() => lblSoLuongOto.Invoke(new Action(() =>
{ {
lblSoLuongOto.Text = vehicle.NumberOfCar.ToString(); lblSoLuongOto.Text = vehicle.NumberOfCar.ToString();
})); }));
lblVehicleTotalIn?.Invoke(new Action(() => lblVehicleTotalIn.Invoke(new Action(() =>
{ {
lblVehicleTotalIn.Text = vehicle.TotalIn; lblVehicleTotalIn.Text = vehicle.TotalIn;
})); }));
lblVehicleTotalOut?.Invoke(new Action(() => lblVehicleTotalOut.Invoke(new Action(() =>
{ {
lblVehicleTotalOut.Text = vehicle.TotelOut; lblVehicleTotalOut.Text = vehicle.TotelOut;
})); }));