public ScanDrivingLicenseViewModel() { _testDriveInfoService = new TestDriveInfoService(); IsLoading = false; TestDriveInfo = new TestDriveInfo { StartDate = DateTime.Now, EndDate = DateTime.Now }; TakePictureCommand = new Command(TakePicture); ContinueCommand = new Command(Continue); MainMenuCommand = new Command(NavigateToMainMenu); }
private async Task <TestDriveInfo> getDriveInfo(TestDrives testDrives) { TestDriveInfo info = new TestDriveInfo(); info.date = testDrives.date; User user = await _context.users.FirstOrDefaultAsync(u => u.idUser == testDrives.userId); Car car = await _context.Cars.FirstOrDefaultAsync(u => u.idCar == testDrives.carId); info.carName = car.mark + " " + car.model + " " + car.built; info.clientFio = user.name; return(info); }
public async Task <HttpStatusCode> AddTestDriveAsync(TestDriveInfo testDriveInfo) { const string url = "http://test-drive-car-management.golden.preview.com.ua/MobileTestDrive/AddTestDrive/"; var httpClient = GetHttpClient(); var jsonTestDriveInfo = await Task.Factory.StartNew(() => JsonConvert.SerializeObject(testDriveInfo)); var response = new HttpResponseMessage(); using (httpClient) { try { response = await httpClient.PostAsync(url, new StringContent(jsonTestDriveInfo, Encoding.UTF8, "application/json")); } catch { response.StatusCode = HttpStatusCode.BadRequest; } } return(await Task.FromResult(response.StatusCode)); }