public async Task <IActionResult> Put(int id, [FromBody] Models.Quiz quiz) { if (id != quiz.ID) { return(BadRequest()); } _context.Entry(quiz).State = EntityState.Modified; await _context.SaveChangesAsync(); return(Ok(quiz)); }
public async Task <IActionResult> Post([FromBody] Models.Quiz quiz) { var userId = HttpContext.User.Claims.First().Value; quiz.OwnerId = userId; _context.Quizzes. Add(quiz); await _context.SaveChangesAsync(); return(Ok(quiz)); }