예제 #1
0
        public async Task <ActionResult <OrganizationDto> > Update(int organizationId, [FromBody] OrganizationFormDto dto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.FormatErrors()));
            }

            var org = await _organizationRetrievalService.GetOrganizationByIdAsync(organizationId);

            dto.CopyTo(org);

            await _organizationManagementService.UpdateOrganizationAsync(org);

            return(Ok(new OrganizationDto(org)));
        }
예제 #2
0
        public async Task <ActionResult <OrganizationDto> > Create([FromBody] OrganizationFormDto dto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.FormatErrors()));
            }

            var org = new Organization();

            dto.CopyTo(org);

            await _organizationManagementService.CreateNewOrganizationAsync(org);

            return(Ok(new OrganizationDto(org)));
        }