Example #1
0
        public static Response Create(CommentViewModel model)
        {
            var response = ResponseFactory.Success(ResponseCode.SuccessEntityCreated);

            if (model == null)
            {
                return(ResponseFactory.Error(ResponseCode.ErrorInvalidInput));
            }

            var comment = model.CopyTo();

            comment.Status = EntityStatus.Active;
            var createdComment = Create(comment);

            if (createdComment == null)
            {
                response = ResponseFactory.Error(ResponseCode.ErrorCreatingEntity);
            }
            return(response);
        }