async void SaveClicked(object sender, EventArgs e) { try { skill.ClassID = getSkillClassID(); if (skill.ClassID > 0) { SkillRepository s = new SkillRepository(); if (skill.ID == 0) { await s.AddSkill(skill); } else { await s.UpdateSkill(skill); } thisApp.needClassRefresh = true; await Navigation.PopAsync(); } else { await DisplayAlert("Class Not Selected:", "You must set the class.", "Ok"); } } catch (AggregateException ex) { string errMsg = ""; foreach (var exception in ex.InnerExceptions) { errMsg += Environment.NewLine + exception.Message; } await DisplayAlert("One or more exceptions has occurred:", errMsg, "Ok"); } catch (ApiException apiEx) { var sb = new StringBuilder(); sb.AppendLine("Errors:"); foreach (var error in apiEx.Errors) { sb.AppendLine("-" + error); } thisApp.needSkillRefresh = true; await DisplayAlert("Problem Saving the Skill:", sb.ToString(), "Ok"); } catch (Exception ex) { if (ex.GetBaseException().Message.Contains("connection with the server")) { await DisplayAlert("Error", "No connection with the server.", "Ok"); } else { await DisplayAlert("Error", "Could not complete operation.", "Ok"); } } }
public SkillModel UpdateSkill(SkillModel skill) { try { return(_skillRepository.UpdateSkill(skill)); } catch (Exception ex) { throw ex; } }
public string UpdateSkill(SkillDetailsModel skill) { return(repo.UpdateSkill(skill)); }