.NET JSON Kode Status Hasil Tidak Bekerja

 //return json with 400 error code with message
            return new JsonResult(new { message = "Error Messages" })
            {
                StatusCode = StatusCodes.Status400BadRequest // Status code here 
            };

//return json with 200 OK status code (it's an Ok type of ObjectResult)
            return new OkObjectResult(new Student { Id = 123, Name = "Hero" });
Mohamed Sami khiari