public async Task AddStateTracking(ObjectStateDto dto) { var objectState = ObjectStateDto.Map(dto); await _dbContext.AddAsync(objectState); await _dbContext.SaveChangesAsync(); }
public async Task DeleteById(int id) { var userToDelete = await _dbContext.Users.SingleOrDefaultAsync(u => u.Id == id); if (userToDelete != null) { _dbContext.Remove(userToDelete); } await _dbContext.SaveChangesAsync(); }
public async Task Create(UserRoleDto createUserRoleDto) { var userRole = new IdentityUserRole <int> { UserId = createUserRoleDto.UserId, RoleId = createUserRoleDto.RoleId }; await _dbContext.UserRoles.AddAsync(userRole); await _dbContext.SaveChangesAsync(); }
public async Task <int> Create(CreateRoleDto createRoleDto) { var role = new Role { Name = createRoleDto.Name }; await _dbContext.Roles.AddAsync(role); await _dbContext.SaveChangesAsync(); return(role.Id); }
public async Task AddRoleToState(RoleStateDto dto) { var roleState = RoleStateDto.Map(dto); await _dbContext.RoleStates.AddAsync(roleState); await _dbContext.SaveChangesAsync(); }