public virtual async Task <LayoutDto> CreateAsync(LayoutCreateDto input)
        {
            var layout = await LayoutRepository.FindByNameAsync(input.Name);

            if (layout != null)
            {
                throw new UserFriendlyException($"已经存在名为 {input.Name} 的布局!");
            }

            layout = new Layout(
                GuidGenerator.Create(),
                input.Path,
                input.Name,
                input.DisplayName,
                input.DataId,
                input.PlatformType,
                input.Redirect,
                input.Description,
                CurrentTenant.Id);

            layout = await LayoutRepository.InsertAsync(layout);

            await CurrentUnitOfWork.SaveChangesAsync();

            return(ObjectMapper.Map <Layout, LayoutDto>(layout));
        }
示例#2
0
 public virtual async Task <LayoutDto> CreateAsync(LayoutCreateDto input)
 {
     return(await LayoutAppService.CreateAsync(input));
 }