public void CreateHistory(GameSessionAnswerHistory answerHistory) { try { answerHistoryRepository.CreateAnswerHistory(answerHistory); } catch (Exception ex) { throw; } }
public void CreateAnswerHistory(GameSessionAnswerHistory answerHistory) { try { context.GameSessionAnswerHistories.Add(answerHistory); context.SaveChanges(); } catch (Exception ex) { throw; } }
public ActionResult CreateAnswerHistory([FromBody] GameSessionAnswerHistory answerHistory) { try { answerHistoryService.CreateHistory(answerHistory); return(new JsonResult("Success")); } catch (Exception ex) { return(new JsonResult(ex.Message)); } }
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); } }