Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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));
        }