title: Retrieving data from DB in C# to Angular
body: <p>I need to Retrieving out for example all the volunteers from the DB
  I wrote the service that gets all the volunteers</p>
  <p>this is the service:</p>
  <pre><code>GetAllVolunteers():Observable&lt;Volunteer&gt;{
      return this.http.get&lt;Volunteer&gt;(environment.url+&quot;ward/GetAllVolunteers&quot;)
    }
  </code></pre>
  <p>here I'm trying to retrieve out the data:</p>
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { Volunteer } from 'src/app/shared/models/volunteers.models';
  import { VolunteerService } from 'src/app/shared/services/volunteer.service';
  
  @Component({
    selector: 'app-all-volunteers',
    templateUrl: './all-volunteers.component.html',
    styleUrls: ['./all-volunteers.component.css']
  })
  export class AllVolunteersComponent implements OnInit {
    allVolunteers: Array&lt;Volunteer&gt; = [];
    constructor(public volunteerService: VolunteerService) { }
  
    ngOnInit(): void {
      this.volunteerService.GetAllVolunteers().subscribe(
        res =&gt; {
          this.allVolunteers=res
        }
      )
    }
  }
  </code></pre>
  <p>this is the function in c# that retrieve all the volunteer:</p>
  <pre><code>[Route(&quot;GetAllVolunteers&quot;)]
          public List&lt;volunteerDTO&gt; GetAllVolunteers()
          {
           return volunteerBL.getAllVolunteers().Select(v =&gt; BL.converts.volunteersConvert.convertVolunteerToDTO(v)).ToList(); ;
          }
  </code></pre>
  <p>How do I place the result in the array allVolunteers[]?</p>
  <p>Thanks in advance</p>