How to receive the data sent from Angular to C# webapi?

Discussão em 'Angular' iniciado por saurav.rox, Fevereiro 25, 2025.

  1. saurav.rox

    saurav.rox Guest

    I am sending form data to c# core web api via Angular. Console shows the data being sent via service to the api. I am trying to update a value. However, when debugger is kept at the web api controller, the data shows null. Here is the angular part:

    this.commonService.updatescheduleFee(this.flatfeeModel).then((response: ResponseModel) => {
    this.toasterMessageService.showSuccess('Fee Schedule Updated Successfully!');
    });


    Here is the update api being hit with the params:

    async updatescheduleFee(params: any) {
    params['amount2'] = 100;
    console.log('FeeSchedule-params',params);

    return await this.ws.put(`${this.billingApiUrl}/invoice/FeeSchedule`,params).toPromise();
    }


    Here is the api part where model shows null for the values sent via Angular:

    [HttpPut("FeeSchedule")]
    public async Task<IActionResult> UpdateFeeSchedule(FeeScheduleRequest1Dto model)
    {
    try
    {
    }
    }


    Here is the console screenshot where all the data that is sent to api can be seen: [​IMG]

    Any help would be more than appreciable.

    Continue reading...

Compartilhe esta Página