public async Task <IActionResult> PutDQuestion(int id, DQuestion dQuestion) { dQuestion.id = id; _context.Entry(dQuestion).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DQuestionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <UserChoice> AddUserChoice(UserChoice userChoice) { try { var result = _context.UserChoices.AddAsync(userChoice); await _context.SaveChangesAsync(); return(userChoice); } catch (Exception ex) { Console.WriteLine(ex.InnerException.Message); return(null); } }
public async Task SaveAsync() { await _context.SaveChangesAsync(); }