コード例 #1
0
        async Task AddDrive()
        {
            AddDriveResponse addDriveResponse = await _dbHelper.AddDrive(new AddDriveRequest
            {
                Driver       = _drive.Driver.Username,
                Participants = _drive.Participants.Select(o => o.Username).ToList(),
                Date         = _drive.Date,
                Dest         = _drive.Destination
            });

            if (!addDriveResponse.Success)
            {
                await _dialogService.ShowMessage("Unable to add drive", "Error", "OK", null);

                return;
            }

            var drives = (await _dbHelper.GetPersonDrives(new GetPersonDrivesRequest
            {
                Username = _drive.Driver.Username
            })).Drives.Select(o => (Drive)o);

            MainPage.Person.Drives = drives.ToList();

            await _navigation.PopToRootAsync();
        }