コード例 #1
0
        public IHttpActionResult Post(CustomerCommentModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Response(new { Success = false }));
            }

            //save the comment
            var comment = new CustomerComment()
            {
                AdditionalData = model.AdditionalData,
                CommentText    = model.CommentText,
                EntityName     = model.EntityName,
                EntityId       = model.EntityId,
                DateCreated    = DateTime.UtcNow,
                DateUpdated    = DateTime.UtcNow,
                CustomerId     = _workContext.CurrentCustomer.Id
            };

            _customerCommentService.Insert(comment);
            var cModel = PrepareCommentPublicModel(comment, new[] { _workContext.CurrentCustomer });

            return(Response(new { Success = true, Comment = cModel }));
        }