public async Task <IHttpActionResult> PostTest(Test test) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } test = await testsRepository.PostTest(test); return(CreatedAtRoute("DefaultApi", new { id = test.Id }, test)); }