public IActionResult DeleteAnswer(int queryNumber, int questionNumber, int answerNumber) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryNumber); var question = QuestionOptions.Load(query, questionNumber); QuestionOptions.DeleteAnswer(question, answerNumber); return(View("LoadQuestion", question)); }
public IActionResult DeleteAnswer(int queryNumber, int questionNumber, int answerNumber) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryNumber); query.Questions = query.Questions.OrderBy(q => q.Order).ToList(); var question = QuestionOptions.Load(query, questionNumber); question.Answers = question.Answers.OrderBy(a => a.Order).ToList(); QuestionOptions.DeleteAnswer(question, answerNumber); return(RedirectToAction("LoadActiveQuery", new { queryID = queryNumber })); }