public async Task SaveTaskAsync(Enrol item) { if (item.Id == null) { await enrolTable.InsertAsync(item); } else { await enrolTable.UpdateAsync(item); } }
async void Enrol_Clicked(object sender, System.EventArgs e) { var menuItem = sender as MenuItem; var course = menuItem.CommandParameter as Course; var co1 = await cou.GetIDAsync(course.Email, course.Date, course.Time); var email = Application.Current.Properties["Email"] as string; var name = Application.Current.Properties["Name"] as string; var phone = Application.Current.Properties["Phone"] as string; Application.Current.Properties["classid"] = co1[0].Id; var id = Application.Current.Properties["classid"] as string; List <Enrol> enrol1 = await en.TestbyIDAsync(email, id); if (enrol1.Count > 0) { await DisplayAlert("Alert", "You have already enrolled this course!", "ok"); } else { var enrol = new Enrol { Teacher = co1[0].Name, Location = co1[0].Location, Date = co1[0].Date, Time = co1[0].Time, Topic = co1[0].Topic, Email1 = email, Email2 = co1[0].Email, Learner = name, Phone = phone, Courseid = id, Phone2 = co1[0].Phone }; await en.SaveTaskAsync(enrol); await DisplayAlert("Notice", "Enrolled successful!", "ok"); } }
public async Task DeleteTaskAsync(Enrol item) { await enrolTable.DeleteAsync(item); }
public async Task UpdateTaskAsync(Enrol item) { await enrolTable.UpdateAsync(item); }