示例#1
0
        public ActionResult RemoveQuection(Guid id)
        {
            BOQuestion BOQ = new BOQuestion();

            BOQ.QueId = id;
            var Response = client.DeleteAsync("Question/" + BOQ.QueId).Result;

            if (Response.IsSuccessStatusCode)
            {
                var Responsedata = Convert.ToBoolean(Response.Content.ReadAsStringAsync().Result);

                if (Responsedata == true)
                {
                    return(RedirectToAction("ManageCategory", "Category"));
                }
                else
                {
                    TempData ["DeleteSuccess"] = false;
                }
            }
            else
            {
                Console.WriteLine("Fail");
            }
            return(null);
        }
示例#2
0
文件: Passage.cs 项目: h4ltYu/EOS
        public void LoadQuestions(ISessionFactory sessionFactory)
        {
            BOQuestion boquestion = new BOQuestion(sessionFactory);

            this._passageQuestions = (ArrayList)boquestion.LoadPassageQuestion(this._pid);
        }
示例#3
0
        public async System.Threading.Tasks.Task <ActionResult> InsertQuection(FormCollection FC)
        {
            if (ModelState.IsValid)
            {
                BOQuestion BOQ = new BOQuestion();

                BOQ.Question1 = FC ["Question1"];

                if (BOQ.Question1 != "")
                {
                    if (FC ["Queid"] != null)
                    {
                        BOQ.QueId = Guid.Parse(FC ["Queid"]);
                        var Response = await client.PutAsJsonAsync("Question", BOQ);

                        if (Response.IsSuccessStatusCode)
                        {
                            var Responsedata = Convert.ToBoolean(Response.Content.ReadAsStringAsync().Result);

                            if (Responsedata == true)
                            {
                                TempData ["UpdateSuccess"] = true;
                            }
                            else
                            {
                                TempData ["UpdateSuccess"] = false;
                            }
                        }
                        else
                        {
                            ViewBag.UpdateSuccess = false;
                        }
                    }

                    else
                    {
                        var Response = await client.PostAsJsonAsync("Question", BOQ);

                        if (Response.IsSuccessStatusCode)
                        {
                            var Responsedata = Convert.ToBoolean(Response.Content.ReadAsStringAsync().Result);

                            if (Responsedata == true)
                            {
                                TempData ["InsertSuccess"] = true;
                            }
                            else
                            {
                                TempData ["InsertSuccess"] = false;
                            }
                        }
                        else
                        {
                            ViewBag.InsertSuccess = false;
                        }
                    }
                }
                else
                {
                    TempData ["DataNull"] = true;
                }
            }
            else
            {
                TempData ["DataNull"] = true;
            }
            return(RedirectToAction("ManageQuection", "Question"));
        }