예제 #1
0
        public async Task <ActionResult> DisabledAsync(int id, [FromForm] string description)
        {
            Domain.Posts.Post post   = Domain.Posts.Hub.GetPost(id);
            Domain.Resp       detail = await post.DisabledAsync(description);

            return(Pack(detail));
        }
        public async Task <IActionResult> BackAsync(int id, [FromBody] Share.SingleContent model)
        {
            Domain.Questions.Question question = Domain.Questions.Hub.GetQuestion(id);
            Domain.Resp resp = await question.BackAsync(model.Content);

            return(Pack(resp));
        }
예제 #3
0
        public async Task <ActionResult> GetDetailAsync(int id)
        {
            Domain.Posts.Post post   = Domain.Posts.Hub.GetPost(id);
            Domain.Resp       detail = await post.GetDetail();

            return(Pack(detail));
        }
예제 #4
0
        public async Task <IActionResult> UnLikeAsync(int id)
        {
            Domain.Answers.Answer answer = Domain.Answers.Hub.GetAnswer(id);
            Domain.Resp           r      = await answer.UnLikeAsync();

            return(Pack(r));
        }
        public async Task <IActionResult> GetDetailAsync(int id)
        {
            Paginator pager = Paginator.New(1, 10);

            Domain.Questions.Question question = Domain.Questions.Hub.GetQuestion(id);
            Domain.Resp resp = await question.GetDetailAsync(Domain.Questions.Question.DetailSource.Admin, pager);

            return(Pack(resp));
        }
예제 #6
0
        public async Task <IActionResult> PostCommentAsync(int id, [FromBody] string comment)
        {
            //  必须登录
            if (CurrentUser.IsEmpty())
            {
                return(Pack(Domain.Resp.NeedLogin()));
            }

            if (string.IsNullOrWhiteSpace(comment))
            {
                return(Pack(Domain.Resp.Fault(Domain.Resp.NONE, "追问不能未空")));
            }

            Domain.Answers.Answer answer = Domain.Answers.Hub.GetAnswer(id);
            Domain.Resp           r      = await answer.AddCommentAsync(CurrentUser.Id, comment);

            return(Pack(r));
        }
예제 #7
0
        public async Task <IActionResult> ChangePasswordAsync([FromBody] Domain.Clients.Models.ChangePassword model)
        {
            Domain.Resp r = await CurrentUser.ChangePasswordAsync(model);

            return(Pack(r));
        }
예제 #8
0
        public async Task <IActionResult> ChangeUserNameAsync([FromBody] Domain.Clients.Models.UserModify model)
        {
            Domain.Resp r = await CurrentUser.ChangeUserInfoAsync(model);

            return(Pack(r));
        }