Пример #1
0
        private async void saveLessonToDB(object sender, EventArgs e)
        {
            string lessonNameValue = lessonName.Text;
            Option optionValue     = (Option)optionPicker.SelectedItem;
            int    teacher_id      = App.currentTeacher.ID;
            Lesson lesson          = new Lesson(lessonNameValue, teacher_id, optionValue.ID);

            if (!InputValidation(lessonNameValue, optionValue))
            {
                return;
            }


            if (await lessonService.AddLessonToDB(lesson))
            {
                await DisplayAlert("success", "Lesson added successfully", "Okay");
            }
            else
            {
                await DisplayAlert("error", "An error occured, Please try again!", "try again!");
            }
        }