Esempio n. 1
0
        public async Task <AuthorDto> CreateAsync(CreateAuthorDto input)
        {
            var author = await _authorManager.CreateAsync(
                input.Name,
                input.BirthDate,
                input.ShortBio
                );

            await _authorRepository.InsertAsync(author);

            return(ObjectMapper.Map <Author, AuthorDto>(author));
        }
        public async Task <AuthorDto> CreateAsync(CreateAuthorDto input)
        {
            var author = await _authorManager.CreateAsync(
                input.Name,
                input.BirthDate,
                input.ShortBio
                );

            author.SetProperty("Title", "My Title")
            .SetProperty("IsSuperUser", true);
            await _authorRepository.InsertAsync(author);

            return(ObjectMapper.Map <Author, AuthorDto>(author));
        }
Esempio n. 3
0
        public async Task <AuthorDto> CreateAsync(CreateAuthorDto input)
        {
            var result = await AuthorizationService.AuthorizeAsync("BookStore.Authors.Create");

            if (result.Succeeded == false)
            {
                throw new AbpAuthorizationException("报错啦");
            }
            var author = await _authorManager.CreateAsync(
                input.Name,
                input.BirthDate,
                input.ShortBio
                );

            await _authorRepository.InsertAsync(author);

            return(ObjectMapper.Map <Author, AuthorDto>(author));
        }