//questionID, quizTakerID public async Task <JsonResult> QUAGet(string id, string qtid) { try { var data = QuizUserAnswerService.GetByQQIDQTID(Guid.Parse(id), Guid.Parse(qtid)); return(Success(QuizUserAnswerVM.MsToVMs(data))); } catch { return(Failed(MessageUtilityService.ServerError())); } }
public static List <QuizQuestionsVM> SetUserAnswers(Guid qtid, List <QuizQuestionsVM> list) { foreach (var item in list) { item.UserAnswers = QuizUserAnswerVM.MsToVMs(QuizUserAnswerService.GetByQQIDQTID(Guid.Parse(item.ID), qtid)); } return(list); }
public static bool Insert(Guid id, Guid qtid, Guid qqid, Guid qaid, string oa, float pe) { try { var data = QuizUserAnswerVM.set(id, qtid, qqid, qaid, oa, pe); using (var context = new CentralProcessContext()) { context.QuizUserAnswerDB.Add(data); context.SaveChanges(); return(true); } } catch { return(false); } }
public static bool Insert(Guid id, Guid qtid, Guid qqid, Guid qaid, string otherAnswer, int points) { try { using (var context = new GeopersonContext()) { var data = QuizUserAnswerVM.set(id, qtid, qqid, qaid, otherAnswer, points); context.QuizUserAnswerDB.Add(data); context.SaveChanges(); return(true); } } catch { return(false); } }
public async Task <JsonResult> QUAGet() { try { var qiid = Guid.Parse(Request.Form["qiid"]); var aid = Guid.Parse(Request.Form["aid"]); var qtid = Guid.Parse(Request.Form["qtid"]); var questions = QuizQuestionsService.GetByQIID(qiid); questions = QuizQuestionsService.SortByOrder(questions, false); var vmQues = QuizQuestionsService.SetSubDatas(questions, aid); var uanswers = QuizUserAnswerVM.MsToVMs(QuizUserAnswerService.GetByQTID(qtid)); foreach (var model in vmQues) { model.UserAnswers = uanswers.Where(x => x.QuizQuestionID == model.ID).ToList(); } return(Success(vmQues)); } catch { return(Failed(MessageUtilityService.ServerError())); } }