Ejemplo n.º 1
0
        private async Task NewReply(NewReplyModel model, string UserId)
        {
            if (string.IsNullOrWhiteSpace(model.Content))
            {
                form.Toast("还是写点什么吧");
                return;
            }

            if (Topic is null)
            {
                ToastError($"主贴不存在或已被删除");
                NavigationManager.NavigateTo("/");
                return;
            }

            BZReplyDto bZReplyDto = new BZReplyDto()
            {
                Content        = model.Content,
                UserId         = Topic.CreatorId,
                Favor          = 0,
                CreateDate     = DateTime.Now,
                LastModifyDate = DateTime.Now,
                Status         = 0,
                TopicId        = Topic.Id,
                CreatorId      = UserId
            };

            await WithFullScreenLoading(async() =>
            {
                var addResult = await NetService.AddReply(bZReplyDto);
                if (addResult.IsSuccess)
                {
                    NavigationManager.NavigateTo(NavigationManager.Uri, true);//跳转到+"&golast=1"
                }
                else
                {
                    ToastError("回复失败");
                    return;
                }
            });
        }