Ejemplo n.º 1
0
        public async Task <IActionResult> PostSchool([FromBody] School school)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _SchoolService.AddAsync(school);

            return(CreatedAtAction("GetSchool", new { id = school.Id }, school));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <School> > AddAsync([FromBody] School schoolAdmin)
        {
            var item = await _schoolService.AddAsync(schoolAdmin);

            return(CreatedAtAction(nameof(GetByIdAsync), new { id = item.Id }, item));
        }