Questions tagged [asp.net-mvc-web-api]
90 questions
41
votes
3 answers
Should we call Web API from MVC application in same solution?
I am working on a project in MVC that has mobile application so one thing is clear that we have to use Web API so it can used in mobile application.
After creating API when we started to develop Web site we are confused and had discussion on whether…

Ruchir Shah
- 547
- 1
- 4
- 6
21
votes
2 answers
Isn't CQRS overengineering?
I still remember good old days of repositories. But repositories used to grow ugly with time. Then CQRS got mainstream. They were nice, they were a breath of fresh air. But recently I've been asking myself again and again why don't I keep the logic…

SiberianGuy
- 4,753
- 6
- 34
- 46
17
votes
3 answers
How to support different API Versions
I am writing a Rest API and am wondering how best to handle supporting the different versions. By this I don't mean how to define a URI as V2 or V3, but rather how to structure the code given that it'd need to:
Support multiple versions at the same…

Andy Davies
- 273
- 2
- 4
16
votes
5 answers
Pure Front end JavaScript with Web API versus MVC views with ajax
This was more a discussion for what peoples thoughts are these days on how to split a web application.
I am used to creating an MVC application with all its views and controllers. I would normally create a full view and pass this back to the browser…

eyeballpaul
- 339
- 1
- 2
- 4
8
votes
2 answers
Separation of concerns and other best practices across Controllers, Services, Providers and Stores in ASP.NET when building a REST web api
I am traditionally a desktop app developer, but circumstance has thrust me into the role of doing web client and corresponding REST api logic for a project I am involved in. Unfortunately, I'm a one-man-show, so my opportunities to learn new…

Geo...
- 181
- 4
8
votes
2 answers
Should integration tests use database?
I know that integration tests test parts of project that interaction with each other somehow. And I need to test this interaction. And there is the question:
1)Should these tests use real database data? I mean I'll have to connect to a real…

NoImagination
- 111
- 1
- 1
- 5
8
votes
1 answer
when is it necessary or when should a controller be async
When is it absolutely necessary for a controller to be async? Should all controllers be async or is it bad practice to make all of them async unless it is necessary.
Just looking for some general guidelines.

SOfanatic
- 241
- 2
- 9
8
votes
1 answer
Is there an advantage to using WCF or WebAPI for mobile?
I'm looking at doing my first mobile development using Mono Touch and Mono for Android. I'd like them to communicate with an ASP.NET MVC 4 site I'm designing. I've worked with WCF and WebAPI in the past but I'm wondering if there are any…

allen.mn
- 305
- 2
- 8
7
votes
3 answers
Is it okay to have multiple get action methods in ASP .Net Web API controller according to RESTful API constraints?
I have the following interface in my business layer
public interface IUserService
{
void CreateUser(User user);
List FindUsersByName(string searchedString);
User GetUserById(int userId);
User…

Mykhailo Seniutovych
- 273
- 2
- 3
- 6
7
votes
1 answer
One Large API to several microservices vs lots of small APIs each with their own API
I have an application that is beiong split out into a number of services. From a previous question on here, I think that initially JSON/REST is the way to go for communication.
Some of my micro services need to be available publicly, for 3rd parties…

Matt
- 253
- 3
- 5
6
votes
1 answer
Token or ASP.NET Identity based security in ASP.NET Web API 2
Background
I have a Web API 2 project, without any extension of ASP.NET MVC or ASP.NET projects. The API will only be used to communicate between the server and Windows 8, Windows Phone 8.1 and iOS applications. No website will consume the API. The…

MikaelKP
- 63
- 1
- 5
6
votes
2 answers
What am I missing in my (mis)understanding of IoC/DI/Castle Windsor?
Okay, so here's how I understand IoC and DI in Web API to work when using Castle Windsor.
Note, though, that my confidence that I understand it as I should, though, falls somewhere between my confidence I could best Dennis Rodman in a one-on-one…

B. Clay Shannon-B. Crow Raven
- 751
- 3
- 9
- 21
5
votes
1 answer
why Web API 2 has RouteConfig.cs file?
I m working on Web API project, and it is using WebApiConfig.cs file to defined routs for Web API.
Web API fold RouteConfig.cs file. I have googled and they say RouteConfig.cs is for MVC routing. It is actually a confusing statement. Can you please…

user576510
- 211
- 3
- 6
5
votes
1 answer
What is the clean way to pass my LoginContext down through the layers to the data access layer?
I have inherited an API implemented using ASP.NET WebApi 2. The actions on the controllers are all like this:
public object Get(long id) {
LoginContext loginDetails = GetLoginDetails();
if (loginDetails.IsAuthorised) {
return…

David Keaveny
- 267
- 2
- 6
4
votes
1 answer
How to authorize and store user login from a xamarin frontend to a asp.net core api
So I suppose this question isn't as much as a 'How to' but a 'which way' kind of question.
So I have a .net core api backend that makes calls to a dB
I also have a xamarin forms project that connects to the API and gets and posts all info.
However…

dros
- 167
- 3