Ejemplo n.º 1
0
 protected void LinqDataSource2_Selecting(object sender, LinqDataSourceSelectEventArgs e)
 {
     if (Request.QueryString["p"] != null)
     {
         var modx = new ModelDataContext();
         e.Result = modx.Comments.Where(x => x.IdProblem == int.Parse(Request.QueryString["p"]));
     }
     else
     {
         e.Cancel = true;
     }
 }
Ejemplo n.º 2
0
        public static Respuesta Comment(int problemId, String comment)
        {
            var modx = new ModelDataContext();
            string name = Membership.GetUser().UserName;
            Guid userId = (Guid)(Membership.GetUser().ProviderUserKey);
            var newComment = new Comment()
            {
                Commentary = comment,
                IdProblem = problemId,
                IdUser = userId,
                NameUser = name
            };

            modx.Comments.InsertOnSubmit(newComment);
            modx.SubmitChanges();
            return new Respuesta() { Estado = true, Mensaje= "Comment added succesfuly"};
        }