public async Task <IActionResult> OnPostAsync(HintDto hint) { if (!ModelState.IsValid) { return(Page()); } var updateHint = await _hintRepository.GetAsync(x => x.Id == hint.Id); updateHint.Description = hint.Description; updateHint.Processed = true; await _hintRepository.UpdateAsync(updateHint); return(Redirect("~/")); }
public async Task <IActionResult> GetAnswer(int id) { if (id < 1) { return(NotFound("No id given.")); } var hint = await _hintRepository.GetAsync(h => h.Id == id); if (hint == null) { return(NotFound("Hint with given id doesn't exist.")); } return(Ok(JsonHelper.FixCycle(hint.Description))); }