Ejemplo n.º 1
0
        public async void AddNewBtn_Clicked(object sender, EventArgs e)
        {
            Restaurant restaurant = new Restaurant()
            {
                ID       = 0,
                Name     = txtName.Text,
                Address  = txtAddress.Text,
                OpenAt   = dtOpenAt.Time,
                CloseAt  = dtCloseAt.Time,
                Delivery = chkDeliver.IsChecked,
                Dining   = chkDining.IsChecked,
                TakeAway = chkTakeAway.IsChecked,
                Phone    = txtPhone.Text,
                Website  = txtWebsite.Text
            };

            RestaurantRepository repository = new RestaurantRepository();

            if (await repository.AddRestaurent(restaurant))
            {
                if (await DisplayAlert("Notify", "Entity added successfull", "Done", "Add More"))
                {
                    await Navigation.PopAsync(true);
                }
            }
        }