private void Review(HttpContext context) { string answer = context.Request.Params["ans"]; string question = context.Request.Params["ques"]; int bimid = int.Parse(context.Request.Params["bimid"]); PindexProd.dbml.Review review = GetPindexProdContext2.Review.FirstOrDefault(o => o.BIMID == bimid && (o.UserID == Common.UserID || o.SessionID == Common.SessionID)); if (review == null) { review = new PindexProd.dbml.Review(); review.Answer = answer; review.BIMID = bimid; review.Question = question; review.UserID = Common.UserID; review.SessionID = Common.SessionID; GetPindexProdContext2.Review.InsertOnSubmit(review); if (Common.UserID.HasValue) { GetPindexProdContext1.Update(new POCOS.AppUser() { ID = Common.UserID.Value, Points = Common.Points }, new[] { "Points" }); } } else { review.Answer = answer; review.Question = question; } GetPindexProdContext2.SubmitChanges(); var q = from o in GetPindexProdContext2.Review where (o.UserID == Common.UserID || o.SessionID == Common.SessionID) select o.BIMID; context.Response.Write(JsonConvert.SerializeObject(q)); }