예제 #1
0
 public SkillModel DeleteSkill(long skillId)
 {
     try
     {
         return(_skillRepository.DeleteSkill(skillId));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
        async void DeleteClicked(object sender, EventArgs e)
        {
            var answer = await DisplayAlert("Confirm Delete", "Are you certain that you want to delete " + skill.SkillName + "?", "Yes", "No");

            if (answer == true)
            {
                try
                {
                    SkillRepository s = new SkillRepository();
                    await s.DeleteSkill(skill);

                    thisApp.needSkillRefresh = true;
                    await Navigation.PopAsync();
                }
                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);
                    }
                    await DisplayAlert("Problem Deleting 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 string DeleteSkill(SkillDetailsModel skill)
 {
     return(repo.DeleteSkill(skill));
 }