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

            _context.Chores.Add(chore);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(Get), new { id = chore.Id }, chore));
        }
コード例 #2
0
 public async Task SaveChangesAsync()
 {
     await _dbContext.SaveChangesAsync();
 }