Questions tagged as 'asp.net-web-api'

1
answer

Async method with Await on his return [duplicate]

public async Task<IHttpActionResult> NomeMetodo([FromUri] Filtro filtro) { return await Task.Factory.StartNew(() =>Ok(_aplicacao.RetornarDados(filtro))); } I would like to know why the above method makes sense, since it is as...
asked by 18.04.2016 / 15:42
1
answer

jQuery calling an action

I'm developing a web site in ASP.NET MVC that uses jquery to control some plugins like spinner, toastr and others. My question is if I should call Action via jquery to validate the model and within Action make a call rest (which was built...
asked by 13.09.2015 / 00:56
2
answers

Webapi - TryUpdateModel or UpdateModel on an ApiController

I have the following situation, a Person class, with Id properties, Name, Birth, I want to implement a page that can update only the Person Name. My implementation should get a person by their Id, and change only the Name field. I did the bel...
asked by 29.09.2015 / 16:17
1
answer

WebApi 2.0 - ApiControllers in another Assembly do not undergo mapping if runAllManagedModulesForAllRequests="false"

I have a WebApi2 application that implements some ApiControllers . This same application references an Assembly that implements some more. All these controllers use Attribute Routing , as in the following example: [RoutePrefix("s...
asked by 31.03.2015 / 21:06
1
answer

Several methods in the same ApiController

I'm creating an Api web project and wanted to put a set of methods on the same ControllerApi. But in methods, I pass a Json object as a parameter. And since their structure is similar (see example), the controller is confused because it think...
asked by 27.10.2014 / 15:07
1
answer

Wrong JSON format web api

I'm having trouble returning json on my mvc 5 api. In the Get method it returns a string in this format: public string Get() { return "{\"data\":[{\"Codigo\":\"AAAA\",\"Finalidade\":\"AAAA\"},{\"Codigo\":\"AAAA\",\"Finali...
asked by 13.05.2014 / 05:05
2
answers

Limit query in index but not in combo

Good afternoon, In the company's ERP we have a query in the Index that is limited to 80 records. The problem is that in create we have combos that bring more than 150 records and also limiting to 80 records. How can I do to just leave in i...
asked by 05.10.2018 / 18:02
1
answer

How to ensure that the generated JSON does not return error to the Client?

I created a Web API that returns a JSON and has a problem similar to the JSONP: status code 200 OK and anyway returns $ .Ajax (... error: function () ...) . The client consumes the API with Nodes like this: refresh() { axios...
asked by 18.09.2018 / 14:40
1
answer

C # - EF Core questions to create relational model

I'm starting in Asp Net Core and I have the following question: I have a Curso template and a Unidade template, a course has multiple units, and that unit can belong to more than one course. I did the individual Course and Un...
asked by 04.09.2018 / 20:29
2
answers

Timeout Sql Server on a Web Api request

When executing the query I get a TimeOut Sql Server error: Connection Method: public SqlDataReader GetDataReader(string comando) { SqlConnection conn = criaConexao(); // Cria Comando SqlCommand...
asked by 13.09.2018 / 08:38