Ejemplo n.º 1
0
        public async Task <IActionResult> CreateTeacherAsync([FromBody] NewAccountViewModel account)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ValidationError(ModelState)));
            }

            var newTeacher = await _teachersService.CreateTeacherAsync(_mapper.Map <TeacherDto>(account));

            return(CreatedAtRoute("GetTeacher", new { teacherId = newTeacher.Id }, newTeacher));
        }