示例#1
0
        public async Task <AppUserDto> RegisterAsync(UserCreateDto input, RiderCreateDto riderCreateDto)
        {
            var userDto = await base.RegisterAsync(input);

            var userE = await UserManager.FindByNameAsync(userDto.UserName);

            await UserManager.AddToRoleAsync(userE, RolesConsts.Rider);

            var cityDto = await CityRepository.FindAsync(riderCreateDto.CityID) ?? throw new BusinessException("Invalid city");

            await RiderRepository.InsertAsync(new RiderEntity(userDto.Id, riderCreateDto.Geolocation, cityDto.Id), autoSave : true);

            return(userDto);
        }
示例#2
0
 public async Task <AppUserDto> Create([FromBody] RiderCreateDto dto)
 {
     return(await RiderAccountAppService.RegisterAsync(dto.UserCreateDto, dto));
 }