public async Task <ActionResult> SelectStudent(StudentTeacherSelectedRelation selection)
        {
            _context.TeacherSelections.Add(selection);
            await _context.SaveChangesAsync();

            return(StatusCode(201));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <User> > AddUser(User user)
        {
            Regex awsomEmail = new Regex(@"@awsom\.info$");

            if (!awsomEmail.IsMatch(user.Email.ToLower()))
            {
                return(Forbid());
            }

            _context.Users.Add(user);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetUser), new { id = user.Id }, user));
        }