예제 #1
0
        public async Task <ActionResult <Team> > PostTeam(Team team)
        {
            bool isUnique = await _context.IsUnique(team.name);

            if (!isUnique)
            {
                return(ValidationProblem("Name must be unique"));
            }

            await _context.Create(team);

            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetTeam), new { id = team.id }, team));
        }