コード例 #1
0
        public async Task <IActionResult> Get()
        {
            // trivially get some data into the in-memory database.
            Startup.AddTestData(_context);

            var items = await _context.Students.ToListAsync();

            return(Ok(items));
        }
コード例 #2
0
        public async Task <IActionResult> Get(int id)
        {
            // trivially get some data into the in-memory database.
            Startup.AddTestData(_context);

            var item = await _context.Students.FirstAsync(x => x.StudentId == id);

            if (item == null)
            {
                return(NotFound());
            }

            return(Ok(item));
        }