public async Task <IActionResult> Index() { HomepageModel model = new HomepageModel(); RESTCore.RESTCore rest = new RESTCore.RESTCore(); model.Questions = await rest.GetQuestions(); model.Answers = await rest.GetAnswers(); return(View(model)); }
public async Task <IActionResult> SaveUserAnswer(string userLogin, List <int> checkedAnswers) { RESTCore.RESTCore rest = new RESTCore.RESTCore(); List <UserAnswers> userAnswers = new List <UserAnswers>(); foreach (int answerID in checkedAnswers) { userAnswers.Add(new UserAnswers() { AnswerDateTime = DateTime.UtcNow, Answers = new Answers() { ID = answerID }, UserLogin = userLogin }); } await rest.SaveUserAnsewer(userAnswers); return(Ok()); }