I am trying to send a Http.Post request from my Angular application to add an item ("user") to my database. Problem seem to be that my "add user" service storing a method providing this http.post request do not have any effect on my dotnet core API providing the backend. A similar structured Http.Get request is working fine and the dotnet core API backend is sending the data from the database. Also the dotnet core API backend seems working fine. Sending the same http.post request (same Body and same address) from Postman brings a new user to the database. Here is the code maybe you can help me:
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { HttpHeaders } from '@angular/common/http';
@Injectable()
export class AddUserService {
constructor(private _http: Http) { }
addUsers() {
console.log('MethodAddUseractive')
return this._http.post('https://localhost:5001/api/Use',
{"id":41,"name":"Dustin Nachname","email":"[email protected]", "genderid": 1,"bday":"1987-09-10T08:15:14.390102","registration_Day":"2019-12-08T00:00:00.000000"})
.map(res => res.json());
}
}
In addition the method adduser() is called as I can see from the Webconsole entry "MethodAddUseractive"