transfering variable from angular to c# web api

pass multiple parameters to web api get method c#
pass complex object to web api get c#
how to send multiple parameters in post request in angular 6
web api post method with multiple parameters c#
pass object to web api c#
how to pass multiple parameters in get request in restful web api
how to pass list as parameter in web api
pass object to web api post c#

I have sending variable with post function

  someFunction(param) {
    console.log("someFunction> "+param);
       return this.http.post(appSettings.BackEndUrl + '/test/someFunc',param);     
    }

console.log shows

someFunction > 10

In backend I have

public async Task<Object> someFunc(string ttt)
{
    WriteLog("someFunc.txt", "start > "+ttt);

In log I see

start >

even if I change string to int

public async Task<Object> someFunc(int ttt)
{
    WriteLog("someFunc.txt", "start > "+ttt);

I still see only

start > 0

How can I solve it ?

Try adding it as querystring Change this way:

someFunction(param) {
console.log("someFunction> "+param);
   return this.http.post(appSettings.BackEndUrl + '/test/someFunc?ttt='+param);     
}

re: Passing multiple POST parameters to Web API Controller Methods, In this post, we will learn how to pass multiple parameters to Web API controller methods. Web API doesn't allow you to pass multiple complex objects in the method signature of a How to do more in ASP.NET and ASP. In this article, we will learn how to consume/use or fetch data with help of Asp.Net Web API in Angular. To achieve this task we will follow some easy steps. You can see our previous series of articles,

I am not perfectly sure if this is a .Net feature, but I remember using the [FromBody] annotation in front of the parameter you want to get from the body of the request. In addition your param should have the same name in front- and backend.

In your case it would look something like

public async Task<Object> someFunc([FromBody] int param)

I personally dont like to add it to your url since with some data you definetly don't want to have it in there.

How to pass multiple parameters to Web API controller methods , Any client application ranging from Desktop, to devices on any platform can call a Web API and perform Data Read/Write operations. ASP.NET  In this article, we will create a simple Angular 7 application in a step-by-step manner from scratch to perform the CRUD operations using Web API, Angular 7, and SQL Server. Steps required for CRUD Operations.

if you're using ASP.NET Core 2.1+, simply use the [ApiController] attribute to automatically infer the [FromBody] binding source.

ASP.NET Web API: Passing Multiple Objects as an Input Parameters , Hi all, I have an Angular application 6. that has a document viewer and makes from Angular from Client Side to Server Side ASP.NET Web API ¿How can I pass a list of int as parameters from the client side so that later  Create an Angular Project using CLI $ ng new web-api-in-angular-demo. This will prompt you some options like adding routing and stylesheet selection, you can select as per your need. Next, you can run your application by using the below command. $ cd web-api-in-angular-demo $ ng serve

T740055, For ASP.NET Core applications, we can pull configuration data from JSON files, environment variables, or anywhere else we want. NET MVC (non-Core) days, because AngularJS could be used to create “Silo SPAs” quite  Angular In-Memory Web API Angular provides in-memory web API to process HTTP request in test environment. If you are making a request to other domain datatype jsonp should be used. Web API Design - Crafting Interfaces that Developers Love 5 A key litmus test we use for Web API design is that there should be only 2 base URLs per resource.

Passing Data from ASP.NET Core to Angular – try-catch-FAIL, Asp.Net Web API introduces a new powerful REST API which can be consume by a broad range of clients including browsers, mobiles, iphone  Net Web API, SQL Server, Observables, Angular Material and Reactive Forms Posted on Jul 23, 2017 by sasa803 In this long article we will create a CRUD Angular4 application with Reactive Forms, Angular material controls, Observables for server side http service calls to grab the data from the C# Web API and insert, update.

Passing multiple complex type parameters to ASP.NET Web API, I want to make a jQuery ajax GET request to a WebApi, passing two parameters to the controller. I've tried things like: var uri = 'api/  Consume web api in AngularJS In development, sometimes we consume data from different sources, for example, webservices. Today in this article we are going to learn, How to consume webapi using angularjs. ng-repete directive in angularjs; What is WEBAPI As we all know, API stands for Application programming interface.

Comments
  • u sure ? your answer is Get type not POST.
  • yes it's ASP.NET Core 2.1+ can u wire some example ?
  • Just add [ApiController] attribute to your Controller class.
  • [ApiController] public class ValuesController : ControllerBase
  • [ApiController] is in place. it was there from the beginning
  • Check the request content type. It must be 'application/json'