コード例 #1
0
        public async Task <IActionResult> Post(Users user)
        {
            var newUser = await odysseyDB.Users.AddAsync(user);

            await odysseyDB.SaveChangesAsync();

            return(Ok(newUser.Entity));
        }
コード例 #2
0
        public async Task <IActionResult> Delete(int id)
        {
            var song = await odysseyDB.Users.FindAsync(id);

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

            odysseyDB.Users.Remove(song);
            await odysseyDB.SaveChangesAsync();

            return(NoContent());
        }