Не выводят данные с БД

У меня есть БД, с которой я хочу вывести данные. Backend:

[HttpGet("{id}")]
    public async Task<IActionResult> GetIdUser(int id)
    {
        if (id!= null)
        {
            var result = _context.Users.FirstOrDefaultAsync(c => c.Id== id);
            return Ok(await result);
        }
        else
        {
            return BadRequest("NotFoundId");
        }
    }

Сервис:

    user:any;
      getUserById(id:int):void{
          this.httpClient
            .get<Clothes>(`${environment.apiUrl}/${this.url}/${id}`)
            .pipe(tap(result => this.user = result));
  }

Компонент:

user:any;
  private subscription: Subscription;
  Id:string;
  constructor(private userService:UserService, private activateRoute: ActivatedRoute) {
    this.subscription = this.activateRoute.params.subscribe(params => this.Id= params['id'] );
    this.user= this.userService.user;

  }

  ngOnInit(): void {

    this.userService. getUserById(this.Id);
  }

HTML:

<app-carousel-info [user]="user">

</app-carousel-info-info>
<div class="col-lg-6 col-sm-1">
  <span class="text-start ps-lg-5 ">Name: {{user.name}}  </span>
  <h1 class="p-lg-0 ps-lg-5 pt-lg-3 padding-info">age: {{user.age}}
</div>

Но данные не приходят с сервера. Адрес на контроллер правильный, я уверен. Помогите, пожалуйста.


Ответы (0 шт):