Example #1
0
        public IHttpActionResult Post(int id, CommentDetailsRequestModel model)
        {
            var createdComment = this.posts
                                 .AddCommnet(id, model.Content, DateTime.Now, this.User.Identity.GetUserId(), false);

            return(this.Ok(createdComment));
        }
        public IHttpActionResult Delete(CommentDetailsRequestModel model)
        {
            var comment = this.comments.Delete(model.Id, model.UserName);
            var result = this.comments
                .ByIdDeleted(comment.Id)
                .ProjectTo<CommentDetailsResponseModel>()
                .FirstOrDefault();

            return this.Ok(result);
        }
Example #3
0
        public IHttpActionResult Delete(CommentDetailsRequestModel model)
        {
            var comment = this.comments.Delete(model.Id, model.UserName);
            var result  = this.comments
                          .ByIdDeleted(comment.Id)
                          .ProjectTo <CommentDetailsResponseModel>()
                          .FirstOrDefault();

            return(this.Ok(result));
        }
        public IHttpActionResult Post(CommentDetailsRequestModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return this.BadRequest(this.ModelState);
            }

            var comment = this.comments.Add(model.PostId, model.Content, model.UserName);

            var result = this.comments
                .ById(comment.Id)
                .ProjectTo<CommentDetailsResponseModel>()
                .FirstOrDefault();

            return this.Ok(result);
        }
Example #5
0
        public IHttpActionResult Post(CommentDetailsRequestModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }

            var comment = this.comments.Add(model.PostId, model.Content, model.UserName);

            var result = this.comments
                         .ById(comment.Id)
                         .ProjectTo <CommentDetailsResponseModel>()
                         .FirstOrDefault();

            return(this.Ok(result));
        }
Example #6
0
        public IHttpActionResult Post(int id, CommentDetailsRequestModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return this.BadRequest(this.ModelState);
            }

            var createdComment = this.posts
                .AddCommnet(id, model.Content, DateTime.Now, this.User.Identity.GetUserId(), false);

            return this.Ok(createdComment);
        }