예제 #1
0
        public async Task <ActionResult <ReportDto> > CreateUser([FromBody] UserDto userDto)
        {
            var report = userDto.Adapt <User>();

            this.context.Users.Add(report);
            await this.context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetReportById), new { id = report.Id }, report.Adapt <UserDto>()));
        }
예제 #2
0
        public async Task UpdateAsync(UserDto update, CancellationToken cancellationToken)
        {
            var userModel = update.Adapt <ApplicationUser>();

            var entity = await _userManager.FindByIdAsync(update.Id.ToString());

            if (entity != null)
            {
                await _userManager.UpdateAsync(userModel);
            }
        }
예제 #3
0
        public async Task CreateAsync(UserDto user, CancellationToken cancellationToken)
        {
            var userModel = user.Adapt <ApplicationUser>();

            var entity = await _userManager.FindByIdAsync(user.Id.ToString());

            if (entity == null)
            {
                var result = await _userManager.CreateAsync(userModel);
            }
        }
예제 #4
0
 public IDataResult <List <Claim> > GetClaims(UserDto user)
 {
     return(new SuccessDataResult <List <Claim> >(UserManager.GetClaimsAsync(user.Adapt <AppUser>()).Result.ToList()));
 }