public async Task <ActionResult <McqQuestion> > PostMcqQuestion(McqQuestion mcqQuestion) { _context.McqQuestion.Add(mcqQuestion); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMcqQuestion", new { id = mcqQuestion.McqId }, mcqQuestion)); }
public async Task <IActionResult> PutMcqQuestion(int id, McqQuestion mcqQuestion) { if (id != mcqQuestion.McqId) { return(BadRequest()); } _context.Entry(mcqQuestion).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!McqQuestionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }