public IActionResult Create([FromBody] TestResult test) { switch (_testRepo.Create(test)) { case DBErrors.Success: return(Ok()); case DBErrors.UserId_NotFound: return(Problem("A valid UserId is needed.", statusCode: (int)HttpStatusCode.BadRequest)); case DBErrors.TeachingCategoryId_NotFound: return(Problem("A valid TeachingCategoryId is needed.", statusCode: (int)HttpStatusCode.BadRequest)); case DBErrors.NullExeption: return(Problem("A mandatory field does not support 'null' value or is missing", statusCode: (int)HttpStatusCode.BadRequest)); case DBErrors.IncorrectNumber: return(Problem("A result should be between 0 to 20.", statusCode: (int)HttpStatusCode.BadRequest)); default: return(Problem("?", statusCode: (int)HttpStatusCode.NotFound)); } }