Пример #1
0
        private async Task <(bool success, string message)> SaveNotification(AppDbContext ltctx, mMember member, string message)
        {
            var _result = (success : false, message : "ok");

            try
            {
                var _notify = new mNotify()
                {
                    LoginId    = member.LoginId,
                    NotifyTime = DateTime.Now,

                    Message = message,
                    IsRead  = false
                };

                ltctx.tb_lion_notify.Add(_notify);

                _result.success = await ltctx.SaveChangesAsync() > 0;
            }
            catch (Exception ex)
            {
                _result.message = ex.Message;
            }

            return(_result);
        }
        public async Task NotifyAction(mNotify item)
        {
            if (item.Why == Keys.NotifyWhys[1])// new-question
            {
                mQuestion question = await QuestionService.Instance.FetchQuestion(item.Objecter);

                if (question == null || question.Answer != Strings.No_Answer || QuestionAnswered)
                {
                    return;
                }

                var result = await DialogService.DisplayAlert(Strings.Answer, Strings.Close, Strings.Answer_Question, question.Question);

                if (!result)
                {
                    return;
                }

                var answer = await DialogService.ShowInputPrompt(Strings.Answer, Strings.Close, Strings.Answer_Question, "Q: " + question.Question, "", Acr.UserDialogs.InputType.Default);

                if (string.IsNullOrEmpty(answer))
                {
                    return;
                }

                AnswerQuestion(answer, question);
            }
        }