public HttpResponseMessage GetListHistory(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string AccountID = Content.AccountID.ToString(); List <HistoryM> history = HistoryM.GetListHistory(AccountID); if (history != null && history.Count > 0) { res.Code = 1; res.Message = "Thành công"; res.Detail = history; res.StatusCode = HttpStatusCode.OK; } else { res.Code = -1; res.Message = "Thông thành công"; res.Detail = history; res.StatusCode = HttpStatusCode.NonAuthoritativeInformation; } } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public JsonResult GetQuestionLevel(int Level) { QuestionM q = QuestionM.GetQuestionLevel(Level); Session["DetailID"] = HistoryM.UpdateHistoryDetail("0", Session["HistoryID"].ToString(), q.QuestionID.ToString(), Level.ToString()); //Insert historyDetail return(Json(q, JsonRequestBehavior.AllowGet)); }
// GET: PlayPage/Play public ActionResult Index() { ViewData["Title"] = "AI LÀ TRIỆU PHÚ"; if (Session["Username"] == null) { return(Redirect("/AccountPage/Account")); } else { Session["HistoryID"] = HistoryM.UpdateHistory("0", Session["AccountID"].ToString(), 0, "0", 0); //Tạo history } return(View()); }
public HttpResponseMessage UpdateHistory(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string HistoryID = Content.HistoryID.ToString(); string AccountID = Content.AccountID.ToString(); int Level = int.Parse(Content.Level.ToString()); string Total = Content.Total.ToString(); int Type = int.Parse(Content.Type.ToString()); int historyM = HistoryM.UpdateHistory(HistoryID, AccountID, Level, Total, Type); if (historyM > 0) { res.Code = 1; res.Message = "Cập nhật history thành công"; res.Detail = historyM; res.StatusCode = HttpStatusCode.OK; } else { res.Code = -1; res.Message = "Cập nhật history không thành công"; res.Detail = historyM; res.StatusCode = HttpStatusCode.NonAuthoritativeInformation; } } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public HttpResponseMessage UpdateHistoryDetail(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string DetailID = Content.DetailID.ToString(); string HistoryID = Content.HistoryID.ToString(); string QuestionID = Content.QuestionID.ToString(); string AnswerLevel = Content.AnswerLevel.ToString(); int historyM = HistoryM.UpdateHistoryDetail(DetailID, HistoryID, QuestionID, AnswerLevel); if (historyM > 0) { res.Code = 1; res.Message = "Cập nhật history detail thành công"; res.Detail = historyM; res.StatusCode = HttpStatusCode.OK; } else { res.Code = -1; res.Message = "Cập nhật history không detail thành công"; res.Detail = historyM; res.StatusCode = HttpStatusCode.NonAuthoritativeInformation; } } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
// GET: HistoryPage/History public ActionResult Index() { ViewData["Title"] = "AI LÀ TRIỆU PHÚ"; if (Session["Username"] == null) { return(Redirect("/AccountPage/Account")); } else { List <HistoryM> lst = HistoryM.GetListHistory(Session["AccountID"].ToString()); if (lst.Count > 0) { ViewData["List"] = true; ViewData["gird"] = lst; } else { ViewData["List"] = false; ViewData["gird"] = ""; } } return(View()); }
public void Stop(int Level, int Type) { HistoryM.UpdateHistory(Session["HistoryID"].ToString(), Session["AccountID"].ToString(), Level, "0", Type); }
public int CheckAnswer(int QuestionID, int AnswerLevel) { HistoryM.UpdateHistoryDetail(Session["DetailID"].ToString(), Session["HistoryID"].ToString(), QuestionID.ToString(), AnswerLevel.ToString()); //update kết quả historyDetail return(PlayM.CheckAnswer(QuestionID, AnswerLevel)); }