asp.net mvc form add comment

Posted by Pinu on Stack Overflow See other posts from Stack Overflow or by Pinu
Published on 2010-05-03T14:28:19Z Indexed on 2010/05/03 14:38 UTC
Read the original article Hit count: 511

Filed under:

I have a page where a product appears on the right side and the user can add comment so i have a user control which gets all the comments and a small text area where user can add new comment for that product.

the link of the page is like

http://localhost/Product/TestComment/1

Where 1 indicates the id of the product and I have been hard coding my AddNote function below and fourth argument you see has been hard coded, but i need to pass that as the id of the product. How do i do this

AddNote(HttpContext.User.Identity.ToString(), txtComment, 1, DateTime.Now, true);

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult AddComment(string txtComment)
{
    bool rst = _NotesService.AddNote(HttpContext.User.Identity.ToString(), txtComment, 1, DateTime.Now, true);
    return RedirectToAction("TestComment");
}

© Stack Overflow or respective owner

Related posts about asp.net-mvc