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); }
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); }
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)); }
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); }