예제 #1
0
        public IHttpActionResult Get(int id)
        {
            ReplyService service = CreateReplyService();
            var          reply   = service.GetReplyById(id);

            return(Ok(reply));
        }
예제 #2
0
        public IHttpActionResult Get(int commentId)
        {
            ReplyService replyService = CreateReplyService();
            var          reply        = replyService.GetReplyById(commentId);

            return(Ok(reply));
        }
예제 #3
0
        public async Task <IHttpActionResult> GetReplyById(int id)
        {
            ReplyService service = CreateReplyService();
            ReplyDetail  reply   = await service.GetReplyById(id);

            return(Ok(reply));
        }
예제 #4
0
        public ActionResult Update(int?id)
        {
            //參數錯誤
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //查無文章
            var model = _replyService.GetReplyById(id.Value);

            if (model == null)
            {
                return(HttpNotFound());
            }
            //已刪除文章不允許回覆
            if (model.IsDel)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            return(View(model));
        }