public Task <int> SaveEvents(EventsList item) { lock (lockerEvent) { if (item.ID != 0) { //Update Item return(database.UpdateAsync(item)); //return item.ID; } else { //Insert item return(database.InsertAsync(item)); } } }
public async void SaveEvents(string remTitle, string sDatepick, string sDate, string sMonth, string sTimepick, string eDatepick, string eTimepick, string totalTime) { try { EventsList OReg = new EventsList(); OReg.title = remTitle; OReg.startDate = sDatepick; OReg.strtDate = sDate; OReg.strtMonth = sMonth; OReg.startTime = sTimepick; OReg.endDate = eDatepick; OReg.endTime = eTimepick; OReg.overallTime = totalTime; int result = await App.Database.SaveEvents(OReg); await DisplayAlert("res", result.ToString(), "ok"); } catch (Exception e) { await DisplayAlert("error", e.Message, "ok"); } }