コード例 #1
0
        //public async Task<IActionResult> OnPostDeleteAsync(string[] ids)
        //{
        //    var entity = await _sysMenuService.GetFullListAsync(_ => ids.Contains(_.Id) && _.IsLocked == false);
        //    var buttons = await _sysButtonService.GetFullListAsync(_ => ids.Contains(_.MenuId));

        //    await _sysButtonService.DeleteAllAsync(buttons);
        //    await _sysMenuService.DeleteAllAsync(entity);
        //    await _sysMenuService.RemoveMenuAsync();
        //    IEnumerable<string> unDeleteIds = ids.Except(entity.Select(_ => _.Id));
        //    return Ok(unDeleteIds);
        //}

        public async Task <IActionResult> OnPostAddCatalogAsync(CatalogDto catalog)
        {
            if (string.IsNullOrEmpty(catalog.Name))
            {
                return(Ok("目录名称不能为空", false, "目录名称不能为空"));
            }
            var entity = await _catalogService.CreateOrUpdateAsync(catalog);

            return(Ok(entity.Id));
        }