public async Task <bool> DeleteQuestionAnswersAsync(int id) { var questionsAnswers = QuestionsAnswers.Where(n => n.AnswerID == id).FirstOrDefault(); var result = await StoreManager.QuestionsDetailsService.DeleteAnswerAsync(questionsAnswers.Qid, questionsAnswers.AnswerID); if (result.Success) { var index = QuestionsAnswers.IndexOf(questionsAnswers); QuestionsAnswers.RemoveAt(index); if (QuestionsAnswers.Count == 0) { LoadStatus = LoadMoreStatus.StausNodata; } QuestionsDetails.CommentDisplay = (questions.AnswerCount = questions.AnswerCount - 1).ToString(); } else { Crashes.TrackError(new Exception() { Source = result.Message }); Toast.SendToast("删除失败"); } return(result.Success); }
public void EditComment(QuestionsAnswers comment) { var book = QuestionsAnswers.Where(b => b.AnswerID == comment.AnswerID).FirstOrDefault(); if (book == null) { QuestionsAnswers.Add(comment); QuestionsDetails.CommentDisplay = (questions.AnswerCount + 1).ToString(); } else { var index = QuestionsAnswers.IndexOf(book); QuestionsAnswers[index] = comment; } if (LoadStatus == LoadMoreStatus.StausNodata) { LoadStatus = LoadMoreStatus.StausEnd; } }