Ejemplo n.º 1
0
 public CreateCourtViewModel()
 {
     CreateCourt = new Command(async() =>
     {
         await CreateCourtInfo();
         Debug.WriteLine("===================Court Created=====================");
     });
     LoadCourt = new Command(async() =>
     {
         foreach (var item in await App.Database.GetAllPlayer())
         {
             CourtListView.Add(new CreateCourtPageViewCellViewModel(item));
             Debug.WriteLine("===================Player Loaded=====================");
         }
     });
 }
Ejemplo n.º 2
0
        public async Task CreateCourtInfo()
        {
            if (string.IsNullOrEmpty(CourtName) || string.IsNullOrEmpty(CourtAdress))
            {
                await App._Navigation.DisplayAlert("Alert", "You have been alerted", "OK");

                return;
            }
            var NewCourt = new Court()
            {
                CourtName = CourtName, CourtAdress = CourtAdress, DateEstablished = DateEstablished.ToString(), CourtCountry = CourtCountry, CourtType = CourtType
            };

            Debug.WriteLine("--------------- CreatePlayer ----------- " + NewCourt.CourtName + " " + NewCourt.CourtAdress + " " + NewCourt.DateEstablished + " " + NewCourt.CourtCountry);

            CourtListView.Add(new CreatePlayerPageViewCellViewModel((Court)NewCourt));

            await App.Database.SavePlayer(NewCourt);
        }