Example #1
0
        public Comments saveComment(CustomRequestBody body)
        {
            Comments              comment       = body.comment;
            Configurations        configuration = body.configuration;
            ConfigurationComments newEntry      = new ConfigurationComments();

            comment.CreatedOn           = DateTime.Now;
            comment.CreatedBy           = comment.CreatedByNavigation.Id;
            comment.CreatedByNavigation = null;

            dbContext.Comments.Add(comment);
            dbContext.SaveChanges();

            newEntry.CommentId       = comment.Id;
            newEntry.ConfigurationId = configuration.Id;

            dbContext.ConfigurationComments.Add(newEntry);
            dbContext.SaveChanges();

            return(comment);
        }
 public ActionResult <Comments> saveComment([FromBody] CustomRequestBody body)
 {
     return(commentService.saveComment(body));
 }