public virtual void SubmitAnswer(int id, MemoAnswerType memoAnswerType) { var currentMemo = MemoRepository.GetMemo(id); switch (memoAnswerType) { case MemoAnswerType.Bad: currentMemo.RepeatDate = Extensions.GetTomorrow(); currentMemo.PostponeLevel = 0; currentMemo.Scores++; break; case MemoAnswerType.Tomorrow: currentMemo.RepeatDate = Extensions.GetTomorrow(); currentMemo.Scores++; break; case MemoAnswerType.Later: //currentMemo.RepeatDate = DateTime.Now.AddMinutes(1); break; case MemoAnswerType.Cool: var nextPostponeLevel = ((Postpone)currentMemo.PostponeLevel).NextLevel(); currentMemo.RepeatDate = Extensions.GetTomorrow((int)nextPostponeLevel); currentMemo.PostponeLevel = (int)nextPostponeLevel; currentMemo.Scores++; break; default: throw new ArgumentOutOfRangeException(); } MemoRepository.Update(currentMemo); }
private async Task SubmitAnswer(MemoAnswerType memoAnswerType) { ShowLoading(); await Logic.SubmitAnswer(memoAnswerType); HideLoading(); ShowQuestion(); }
public IActionResult Index(MemoAnswerType answer) { //var zero = 0; //var tt = 6 / zero; var memoQueue = JsonConvert.DeserializeObject <Queue <int> >(HttpContext.Session.GetString("Memos")); MemorizerLogic.SubmitAnswer(memoQueue.Dequeue(), answer); HttpContext.Session.SetString("Memos", JsonConvert.SerializeObject(memoQueue)); return(Index()); }
public async Task SubmitAnswer(int id, MemoAnswerType answerType) { var data = new { id, answerType }; await PostAsync($"{BaseUrl}/SubmitAnswer", data); }