Exemplo n.º 1
0
        public HttpResponseMessage AddComment(Comment comment, string lang)
        {
            if (string.IsNullOrWhiteSpace(comment.Content))
            {
                return(Request.CreateResponse(HttpStatusCode.OK));
            }

            if (!postsManager.AddComment(comment.PostId, User.Identity.Name, comment.Content))
            {
                var error = Resources.Errors.ResourceManager.GetString("CommentNotAdded", CultureInfo.GetCultureInfo(lang));
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, error));
            }

            return(Request.CreateResponse(HttpStatusCode.OK));
        }