コード例 #1
0
 public void CreateHistory(GameSessionAnswerHistory answerHistory)
 {
     try
     {
         answerHistoryRepository.CreateAnswerHistory(answerHistory);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #2
0
 public void CreateAnswerHistory(GameSessionAnswerHistory answerHistory)
 {
     try
     {
         context.GameSessionAnswerHistories.Add(answerHistory);
         context.SaveChanges();
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #3
0
 public ActionResult CreateAnswerHistory([FromBody] GameSessionAnswerHistory answerHistory)
 {
     try
     {
         answerHistoryService.CreateHistory(answerHistory);
         return(new JsonResult("Success"));
     }
     catch (Exception ex)
     {
         return(new JsonResult(ex.Message));
     }
 }
コード例 #4
0
 public async Task CreateHistory(int gameSessionId, int userId, int riddleId, string answer, bool correct)
 {
     try
     {
         var history = new GameSessionAnswerHistory()
         {
             GameSessionId = gameSessionId,
             UserId        = userId,
             RiddleId      = riddleId,
             Answer        = answer,
             Correct       = correct,
             AnswerDate    = DateTime.Now
         };
         await client.PostAsJsonAsync <GameSessionAnswerHistory>($"api/answerhistory/createanswerhistory", history);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }