예제 #1
0
        public IActionResult Post([FromBody] Model.Quiz entity)
        {
            ResultOperation result = Model.Save(entity);

            if (result.Success)
            {
                return(Ok(new ResultOperationWithObject(result, entity)));
            }
            else
            {
                return(Ok(result));
            }
        }
예제 #2
0
        public IActionResult Get(int id)
        {
            Model.Quiz quiz = Model.Get(id);

            if (quiz == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(quiz));
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string pid   = Request.Form["pid"];
            string reid  = Request.Form["reid"];
            int    order = Convert.ToInt32(Request.Form["order"]);


            Model.Quiz p1 = search.searchQuizInfo(reid, order);
            p1.code = ReadData(p1.codepath);

            JavaScriptSerializer js = new JavaScriptSerializer();
            //json序列化
            string response = js.Serialize(p1);

            Response.Clear();
            Response.Write(response);
            Response.End();
        }
예제 #4
0
        public Model.Quiz searchQuizInfo(string reid, int order)
        {
            OxcoderIBL.SearchChallengeIBL search = new OxcoderBL.SearchChallengeBL();
            OxcoderIBL.QuizInfoIBL        enter  = new OxcoderBL.QuizInfoBL();

            DataSet ds = search.SearchByChallengeID(reid);

            switch (order)
            {
            case 0:
                ds = enter.QuizInfo(ds.Tables[0].Rows[0]["Challenge_Quiz_First"].ToString());
                break;

            case 1:
                ds = enter.QuizInfo(ds.Tables[0].Rows[0]["Challenge_Quiz_Sec"].ToString());
                break;

            case 2:
                ds = enter.QuizInfo(ds.Tables[0].Rows[0]["Challenge_Quiz_Third"].ToString());
                break;

            default:
                ds = enter.QuizInfo(ds.Tables[0].Rows[0]["Challenge_Quiz_First"].ToString());
                break;
            }

            Model.Quiz p1 = new Model.Quiz();
            p1.chineseName      = ds.Tables[0].Rows[0]["Quiz_Name"].ToString();
            p1.pid              = ds.Tables[0].Rows[0]["Quiz_ID"].ToString();
            p1.codepath         = ds.Tables[0].Rows[0]["Quiz_Info"].ToString();
            p1.countDown        = ds.Tables[0].Rows[0]["Quiz_Time"].ToString();
            p1.order            = order;
            p1.pname            = ds.Tables[0].Rows[0]["Quiz_Pname"].ToString();
            p1.previewfileExist = false;
            p1.ptype            = ds.Tables[0].Rows[0]["Quiz_TypeID"].ToString();
            p1.ptypeName        = ds.Tables[0].Rows[0]["Quiz_Type"].ToString();
            p1.target           = ds.Tables[0].Rows[0]["Quiz_Content"].ToString();
            p1.totalTime        = ds.Tables[0].Rows[0]["Quiz_Time"].ToString();
            p1.input            = ds.Tables[0].Rows[0]["Quiz_Input"].ToString();
            p1.output           = ds.Tables[0].Rows[0]["Quiz_Output"].ToString();
            return(p1);
        }
예제 #5
0
        public Model.Quiz searchQuizInfo(string reid, int order)
        {
            OxcoderIBL.SearchChallengeIBL search = new OxcoderBL.SearchChallengeBL();
            OxcoderIBL.QuizInfoIBL enter = new OxcoderBL.QuizInfoBL();

            DataSet ds = search.SearchByChallengeID(reid);
            switch (order)
            {
                case 0:
                    ds = enter.QuizInfo(ds.Tables[0].Rows[0]["Challenge_Quiz_First"].ToString());
                    break;
                case 1:
                    ds = enter.QuizInfo(ds.Tables[0].Rows[0]["Challenge_Quiz_Sec"].ToString());
                    break;
                case 2:
                    ds = enter.QuizInfo(ds.Tables[0].Rows[0]["Challenge_Quiz_Third"].ToString());
                    break;
                default:
                    ds = enter.QuizInfo(ds.Tables[0].Rows[0]["Challenge_Quiz_First"].ToString());
                    break;
            }

            Model.Quiz p1 = new Model.Quiz();
            p1.chineseName = ds.Tables[0].Rows[0]["Quiz_Name"].ToString();
            p1.pid = ds.Tables[0].Rows[0]["Quiz_ID"].ToString();
            p1.codepath = ds.Tables[0].Rows[0]["Quiz_Info"].ToString();
            p1.countDown = ds.Tables[0].Rows[0]["Quiz_Time"].ToString();
            p1.order = order;
            p1.pname = ds.Tables[0].Rows[0]["Quiz_Pname"].ToString();
            p1.previewfileExist = false;
            p1.ptype = ds.Tables[0].Rows[0]["Quiz_TypeID"].ToString();
            p1.ptypeName = ds.Tables[0].Rows[0]["Quiz_Type"].ToString();
            p1.target = ds.Tables[0].Rows[0]["Quiz_Content"].ToString();
            p1.totalTime = ds.Tables[0].Rows[0]["Quiz_Time"].ToString();
            p1.input = ds.Tables[0].Rows[0]["Quiz_Input"].ToString();
            p1.output = ds.Tables[0].Rows[0]["Quiz_Output"].ToString();
            return p1;
        }
예제 #6
0
 public async Task Post([FromBody] Model.Quiz quiz)
 {
     _quizContext.Add(quiz);
     await _quizContext.SaveChangesAsync();
 }
예제 #7
0
 public QuizVM()
 {
     this.quiz = new Model.Quiz();
 }
예제 #8
0
 public QuizVM(Model.Quiz quiz)
 {
     // TODO: Complete member initialization
     this.quiz = quiz;
 }