Ejemplo n.º 1
0
        public JsonResult DeleteQuestion(List <string> code)
        {
            if (code != null)
            {
                var bus       = new QUESTION_BUS();
                var busAnswer = new ANSWER_BUS();
                foreach (string t in code)
                {
                    var item = bus.GetByID(new QUESTION_OBJ.BusinessObjectID(t));

                    List <ANSWER_OBJ> lianswer = busAnswer.getAllBy(new fieldpara("QUESTIONCODE", t));

                    foreach (var itemAnswer in lianswer)
                    {
                        busAnswer.delete(itemAnswer._ID);
                    }

                    if (t != null)
                    {
                        bus.delete(item._ID);
                    }
                }
                busAnswer.CloseConnection();
                bus.CloseConnection();
            }

            return(Json(new
            {
                ret = 0
            }, JsonRequestBehavior.AllowGet));
        }