public ActionResult Post([FromBody] Comment Comment) { if (!ModelState.IsValid) { return(BadRequest()); } else { db.Comments.Add(Comment); db.SaveChanges(); return(CreatedAtAction("Post", new { id = Comment.CommentId }, Comment)); } }
public ActionResult Post([FromBody] Category category) { if (!ModelState.IsValid) { return(BadRequest()); } else { db.Categories.Add(category); db.SaveChanges(); return(CreatedAtAction("Post", new { id = category.CategoryId }, category)); } }