Пример #1
0
        public async Task <IActionResult> DelQuestion(int id)
        {
            QuestionsBll bll  = new QuestionsBll();
            var          info = await bll.GetByIdAsync(id);

            if (info != null)
            {
                bool flag = await bll.DelAsync(info);

                OptionBll obll = new OptionBll();
                var       list = await obll.GetList(id);

                if (list != null)
                {
                    foreach (Option option in list)
                    {
                        await obll.DelAsync(option);
                    }
                }

                if (flag)
                {
                    return(Json(new { code = 1, msg = "OK" }));
                }
            }
            return(Json(new { code = 0, msg = "删除失败" }));
        }
Пример #2
0
        public async Task <IActionResult> DelOption(int id)
        {
            OptionBll bll  = new OptionBll();
            var       info = await bll.GetByIdAsync(id);

            if (info != null)
            {
                bool flag = await bll.DelAsync(info);

                if (flag)
                {
                    return(Json(new { code = 1, msg = "OK" }));
                }
            }
            return(Json(new { code = 0, msg = "删除失败" }));
        }