コード例 #1
0
 protected void AddComment(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtComment.Text))
     {
         string  result  = "";
         Comment comment = new Comment
         {
             CommentText = txtComment.Text,
             RecipeRef   = Request.QueryString["RecipeID"],
             UserRef     = Context.User.Identity.GetUserName()
         };
         result = comment.AddCommentToDatabase();
         try
         {
             Convert.ToInt32(result);
             lblCommentResult.Text = "Thank you for your comment!";
             txtComment.Text       = "";;
             FillComments();
         }
         catch
         {
             lblCommentResult.Text = result;
         }
     }
 }