async void loadCourses(string lpid) { openPopup(); LP.Children.Clear(); CredentialsService credentials = new CredentialsService(); var current = Connectivity.NetworkAccess; if (current == NetworkAccess.Internet) { lp = await Courses.GetLearningPath(credentials.HomeDomain, credentials.UserID, lpid); if (lp != null) { bool x = await buildLPDetails(lp.StudentActivityMap, lpid); } } else { Courses l = new Courses(); Models.LPDBRecord lp = await l.GetActivityMap(lpid); if (lp != null && lp.LPMap != null && lp.LPMap != "") { JsonSerializerSettings ser = new JsonSerializerSettings(); ser.DefaultValueHandling = DefaultValueHandling.Populate; StudentActivityMap lpMap = JsonConvert.DeserializeObject <StudentActivityMap>(lp.LPMap, ser); bool x = await buildLPDetails(lpMap, lpid); } } closePopup(); }
async Task <bool> buildLPDetails(StudentActivityMap lp, string lpid) { // var x = await App.Database.SaveLpRecord(lp); Cards card = new Cards(); bool x = await Courses.SaveMap(lpid, lp); int count = lp.Objective.Count; foreach (Objective obj in lp.Objective) { await card.buildObjectiveCard(obj, LP, lpid, count); } return(true); }
public Task <int> SaveLpRecord(StudentActivityMap map) { return(database.UpdateAsync(map)); }