public IActionResult UserRoleUpdate([FromForm] UserGetAllDto userGetAllDto) { var entity = _userService.UpdateRole(userGetAllDto); if (entity.Success) { return(Ok(entity.Message)); } return(BadRequest()); }
public async Task <IActionResult> GetUsersById(int id) { var user = await _context.Users.FirstOrDefaultAsync(x => x.Id == id && x.DeletedAt == null); if (user == null) { return(NotFound()); } var userGet = new UserGetAllDto { Username = user.UserName, Id = user.Id }; return(Ok(userGet)); }
public async Task <PagedResultDto <UserDto> > GetAll2(UserGetAllDto input) { CheckGetAllPermission(); var query = Repository.GetAll().Where(input.Where); var count = await query.CountAsync(); var data = await query.OrderBy(u => u.UserName).PageBy(input).ToListAsync(); var list = data.MapTo <List <UserDto> >(); foreach (var tmp in list) { tmp.RoleNames = _roleRepository.GetAll() .Where(w => GetEntityByIdAsync(tmp.Id).Result.Roles.Select(s => s.RoleId).Contains(w.Id)) .Select(s => s.NormalizedName).ToArray(); } return(new PagedResultDto <UserDto>(count, list)); }
//[TransactionScopeAspect]//+++Admin Role güncellemesi yapabilir public IDataResult <UserGetAllDto> UpdateRole(UserGetAllDto userGetAllDto) { _userDal.UpdateRole(userGetAllDto); return(new SuccessDataResult <UserGetAllDto>(Messages.UserUpdated)); }