public async Task <AuthorDto> CreateAsync(CreateAuthorDto input) { var author = await _authorManager.CreateAsync(input.Name, input.BirthDay, 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)); }
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)); }