コード例 #1
0
        public async Task <IActionResult> PostComment([FromBody] Comment comment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            data.AddComment(comment);
            data.commit();

            return(CreatedAtAction("GetComment", new { id = comment.Id }, comment));
        }
コード例 #2
0
 public IActionResult OnPost()
 {
     data.AddComment(comment);
     data.commit();
     return(RedirectToPage("./Post"));
 }