public async Task <IActionResult> PutMtc([FromRoute] int id, [FromBody] Mtc mtc) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mtc.Gid) { return(BadRequest()); } _context.Entry(mtc).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MtcExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostMtc([FromBody] Mtc mtc) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Mtcs.Add(mtc); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMtc", new { id = mtc.Gid }, mtc)); }
private void InitTestWithMultOp() { _settings = new MtcSettings(5, 9, 10, 0, 0, false, MtcOperation.Multiplication, MtcDifficultyLevel.Normal); _questionListBuilder = new MtcQuestionListBuilder(_settings); _mtc = new Mtc(_settings, _questionListBuilder); }