request in angular app returns status 400

I’m trying to send a post request to an core backend in order to validate an input name, but get status 400 bad request.

This is the controller:

public class CompanyController : Controller
    private DataContext DataContext;

    public CompanyController(DataContext dataContext)
        DataContext = dataContext;

    public Company GetCompany(long Id)
        return DataContext.Companies.Find(Id);

    public IEnumerable<Company> GetCompanies()
        return DataContext.Companies;

    public JsonResult ValidateName(string name)
        IEnumerable<Company> companies = DataContext.Companies;

        bool isValid = !companies.Any(c => Common.CleanName(c.Name) == Common.CleanName(name));

        return Json(isValid);

And this is the corresponding service call in the angular app:

  validateName(name: string): Observable<any> {
    return<boolean>("api/masterdata/general/companies/validatename/" + name, null);

Why get I bad request? The GetCompanies api call is f.e. reached and working fine.


%d bloggers like this: