コード例 #1
0
        public async Task <IActionResult> Post([FromBody] Category category)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _context.AddAsync(category);

            return(CreatedAtAction(nameof(GetById),
                                   new { id = category.ID }, category));
        }
コード例 #2
0
        public async Task AddAsync(Player player)
        {
            await _context.AddAsync(player);

            await _context.SaveChangesAsync();
        }