public async Task <ActionResult <TestDto> > CreateTest([FromBody] TestDto test) { if (test != null && ModelState.IsValid) { var newTest = await _testService.AddTestAsync(test); return(CreatedAtAction("GetTest", new { id = newTest.Id }, newTest)); } return(BadRequest("Failed to create a new test")); }