Ejemplo n.º 1
0
        protected async void Save_Clicked(object sender, EventArgs e)
        {
            var newRun = new Run
            {
                PersonID      = PersonID,
                DistanceInKM  = float.Parse(DistanceInKMCell.Text, CultureInfo.InvariantCulture),
                TimeInMins    = Int32.Parse(TimeInMinsCell.Text),
                TimeInSeconds = Int32.Parse(TimeInSecondsCell.Text),
                Terrain       = TerrainCell.Text,
            };

            newRun.setPace();

            try
            {
                using (var runningContext = new RunningContext())
                {
                    await runningContext.Runs.AddAsync(newRun);

                    await runningContext.SaveChangesAsync();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }

            await Navigation.PopModalAsync();
        }
Ejemplo n.º 2
0
        async void DeleteAll_Clicked(object sender, EventArgs e)
        {
            using (var runningContext = new RunningContext())
            {
                runningContext.RemoveRange(runningContext.People);

                await runningContext.SaveChangesAsync();

                peopleCollectionView.ItemsSource = runningContext.People.ToList();
            }
        }
Ejemplo n.º 3
0
        protected async override void OnAppearing()
        {
            peopleCollectionView.SelectedItem = null;

            using (var runningContext = new RunningContext())
            {
                var thePeople = runningContext.People.ToList();

                peopleCollectionView.ItemsSource = thePeople;
            }
        }
Ejemplo n.º 4
0
        protected override void OnAppearing()
        {
            using (var runningContext = new RunningContext())
            {
                List <Run> runsList = runningContext.Runs
                                      .Where(p => p.PersonID == PersonId)
                                      .ToList();
                runsList.Count();

                runsCollection.ItemsSource = runsList;
            }
        }
Ejemplo n.º 5
0
        async void Save_Clicked(System.Object sender, System.EventArgs e)
        {
            var person = new Person {
                Name = Name.Text, Age = Int32.Parse(Age.Text), EmailAddress = EmailAddress.Text, Gender = Gender.Text
            };

            using (var runningContext = new RunningContext())
            {
                runningContext.Add(person);

                await runningContext.SaveChangesAsync();
            }

            await Navigation.PopModalAsync();
        }