예제 #1
0
        public async Task <IActionResult> Create(Option option)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var queriedOptions = await optionsService.GetByIdAsync(option.ParentId);

            if (queriedOptions == null)
            {
                return(NotFound());
            }

            await optionService.CreateAsync(option);

            await optionsService.AddOptionAsync(option.ParentId, option.Id);

            return(Ok(option));
        }