コード例 #1
0
        public async Task <ServiceResult> Add([FromBody] MenuItemAddModel apiEntity)
        {
            var entity = MenuItemAddModel.Map(apiEntity);

            var result = await _menuItemService.AddAsync(entity);

            if (result.TryCastModel(out MenuItem menuItem))
            {
                result.ViewModel = MenuItemViewModel.Map(menuItem);
            }

            return(result);
        }