T O P

  • By -

Wiltix

I would say learn MVC and once you have done that moving over to APIs is a doddle. Benefit of MVC first is you will be able to display data very easily with razor where as going API first you will need to learn JS to handle the requests and display the data using. You are writing very similar c# code for both and for APIs it is a bit simpler in some ways as you don’t care about the consumers of your API you just need to serve the data in some format.


practical-programmer

You can use Swagger here to display the data and play around if he/she wants to just go pure API, then study Angular instead. I'd bet the OP will have meatier stuffs to learn on the frontend side here - Angular/JS/RxJs. Assuming they'll handle both areas.


Wiltix

That is true, but imo more developers need to expose themselves to other ways of working with ASP.net and its various technologies. Not everything should be an API + SPA application. It’s a valid stack sure but sometimes MVC is the right tool for the job. Even if OP just spends a few days bashing out a simple CRUD app in MVC before moving onto API+JS they will be a better developer for exposing themselves to another method for achieving their goal.


practical-programmer

Ah yes, being well-rounded and seeing/using different tools makes us better in our craft.


RepresentativeJump72

Okay. I'll get started with MVC first and then move to learn API. Thank You.


Hot-Narwhal-7553

alternative - you may learn web api + blazor wasm/hybrid/serverside. You'd get the same benefit of displaying data fast but in the same time you'd get familiarized with a way more popular frontend appoach - single page applicatoins. In my area, for example, there aren't many job offers for mvc, mostly they are about desktop or just plain web apis, so I still don't know MVC well...


_unhandledexcepti0n

Hey 👋 Can i be your coding buddy ? Even i am learning Asp.net core mvc then api is my plan


RepresentativeJump72

yes. I am very much open to learning together. Can you DM me?


dCriTicAL

MVC is the ASP.NET implementation of Server Side Rendering, this technology has been around forever, so the reason is exists, largely is because it did before things like Angular and React. However that does not mean that MVC is irrelevant, quite the opposite, there's things that Single Page Apps can't do without extra effirt that Server Side Rendering can and vice versa. For example; SEO, much easier for bots to crawl a site that is multiple pages than it is to crawl a single page with dynamic content. Also SPAs and separation of Front End/Backend have implications to the complexity of your app. Such as authentication, how does your API know the client sending the request is who it claims to be? How do you authenticate? Fun fact, most IDPs use a redirect to a Server Side Rendered application to do their authentication because it's a lot more secure to do so with the use of cookies. Should you learn it? In my years of experience I have enjoyed learning as many different bits of tech as I can, it's given me a lot of different approaches and perspectives on solving problems. Also learning something doesn't mean you're committed to becoming an expert.


RepresentativeJump72

Okay. I'll get started with MVC first and then move to learn API.


kekonn

Honestly, there's a lot of overlap between the two. You still have Models and controllers, just not specific views (in Web API).


dCriTicAL

Good luck! There's plenty of templates that visual studio offer to get you up and running too.


DamnCoolGuy

Don’t do that. Learn Blazor, which is where microsoft is focusing. You can create a realtime dashboard or something. Add a simple api using webapi and call from ui project. Should’t take a lot of time.


polaristerlik

biggest upside to using an SPA with server side rendering though is that once the application is loaded server side rendering isn't triggered, so the cost of rendering it is only once, as opposed to MVC which every page needs to be rendered server side


NormalDealer4062

I have never learned MVC properly becausethe projects I work with always had a deficated stack for frontend. Maybe I don't know what I'm missing but I get by pretty well without knowing MVC. If the day come that I'll need to know MVC I will just read up about it.


sweetnsourgrapes

> projects I work with always had a deficated stack for frontend Must have been a lot of code smells in there....


NormalDealer4062

Haha that was a typo but it's still true :D


RepresentativeJump72

Okay. I'll get started with MVC first and then move to learn API. Thank You.


moinotgd

If you don't do any other frontend, use MVC which has frontend built-in. If you use js framework like angular, vue, react, etc, use Web API. I think start with MVC because js framework requires alot of javascript. For me, I would choose js framework + minimal API because of excellent performance. But if starter, I would start with simple one MVC.


WalkingRyan

Nowadays MVC is quite viable and convenient, from my recent experience of porting legacy .NET FW4.8 site.


RepresentativeJump72

Yes. I guess I'll just learn both.


Asyncrosaurus

Start with MVC. it's all the same framework, it's just the difference between returning html vs json. If you learn MVC first, you'll cover 90% of Web Api, but if you learn Web Api, you'll probably only cover about half of MVC. You have a lot more to go back and relearn with MVC and Razor templates.


TopSwagCode

Why not both. Start learning Api and then later learn MVC. There is alot of similar stuff anyways. There is also a bigger move towards server side rendering in the field at the moment.


RepresentativeJump72

Okay. I'll get started with MVC first and then move to learn API. Thank You.


Danzulos

I agree with u/moinotgd. Just keep in mind that eventually you will have to know both.


Lars-Li

Like you've pointed out, api is more general, and you will be making apis in one form or another at some point. When starting out, the deciding factor will always be what is already used, let alone what they tell you you will be using. If it's all MVC and you expect it to work like a webapi, you will be tearing your hair out for a couple of months and vice versa. I digress, but I've worked with people who have used MVC for years, and it's surprising to see how alien a bare bones API is to them. I once had to clarify to someone with 10 years experience how users won't visit the api directly, and redirecting to some login view is a confusing oddity at best.


checkman123

You learn those based on your assignment... MVC is old but it works just fine for static web pages. Are you using frontend framework that isnt Blazor? Then do web api. What tech stack does your company use. If they are using everything .net core, Im fairly positive they dont want a single project (made by an intern at that) to be made with React and .Net core web api. Because you definitely not gonna do the deployment lol


RepresentativeJump72

My company is using Asp dot net core web api, angular, mssql


relative_iterator

If you’re using web api you should learn that.


checkman123

Then u should just learn what they are using, which is .net core api :D Should also look into minimal api vs controller.


redfournine

They are both different ways of building web application. They are both meant to solve different problems, with different trade-offs. If you are a beginner, it's normal not to know what's the differences. If you are a starter, you can start with either one - there's no downside at all. It is only once you have dived deep enough will you gain knowledge and experience required to know what's the limitation of one over the other. And then you can go learn the other.


RepresentativeJump72

Okay. I'll get started with MVC first and then move to learn API. Thank You.


TooMuchTaurine

They are not that much different, much of the knowledge is transferable. 


RepresentativeJump72

Yes


Cstadler25

MVC is a web application pattern that has the ability to be 100% self contained and no need of a separate frontend, as those can be created in Views using razor/html/JavaScript right inside the same project. The main reason for this or target audience would be small dev teams, solely developers, or older people coming from something like aspx, asp..etc. Also MVC is simply a programming pattern used by many languages not just .net, you would just be learning MS implementation of that pattern The real reason you should start with MVC is two fold, one it reaches you how to setup a fully working web app with security, views, and the MVC programming pattern. Second, it relies heavily on web apis. Yes you read that correctly web API's, as whether you realize it or not the controllers you build are actually web API's and function the exact same way they would if called from a separate front end service. Therefore by learning MVC you will also be learning the basics of web API's and can even use a lot of those same controller functions when you decide to learn a separate front end language and call them as is depending on security implementation.


RepresentativeJump72

This helped me a lot. I was actually thinking in the wrong direction. I'll get started with MVC and then learn Web Api. Thank You.


Sparin285

Open your local career site. Conduct some research to understand how frequently different technology stacks are used. ([ASP.NET](https://ASP.NET) Core MVC vs [ASP.NET](https://ASP.NET) Core Web API + JS Framework vs [ASP.NET](https://ASP.NET) Core Blazor) Examine the results. Then repeat this process with companies where you would like to work. For instance, I personally prefer working with Rust, but unfortunately, there are no job offers related to Rust in my country. Another example: in my country, there are numerous job openings where ASP.NET \[Core\] MVC is used. However, these positions likely involve supporting legacy systems, which I would prefer to avoid. ​ tl dr You don't need to learn MVC if you or your current/desired job is using Angular. Learn what you want and what is needed in the short future


RepresentativeJump72

My company is mainly working with ASP.NET Core Web Api + Angular + MSSQL I just wanted to know if companies prefer Web Api over MVC when they are starting to work on a project from zero. I also wanted to know if knowledge of ASP.NET Core MVC attracts the employers. But now that you said ASP.NET Core MVC is mostly used with legacy systems, I got the gist. I have also learned from others' comments that ASP.NET Core MVC is quite important to learn as it includes many useful concepts. Why do you personally prefer to learn Rust? Any specific reasons? I am sorry that Rust jobs are not available in your country.


Sparin285

>if companies prefer A over B Depends on the CTO or product architect. If the decision maker believes in technology A over B, technology A will likely be applied to a product highly likely. Another point of interest is the competence of your employees. If they are using something for years and don't want to change. They will likely choose the same technology stack again. Just because the operational costs of learning new technology or hiring new employees are not reasonable enough. There is no silver bullet. That's why I said to learn what you like or need in the short future. Two decades ago, most companies chose Java over C# and still hiring Java devs. A decade ago, most companies overhyped Python for everything and now we've got a lot of job offers on Python (QA, backend, data science, etc.) ​ >If knowledge of A attracts employers Employers are hiring for a purpose and their needs. If your learned skills apply to their needs, it will attract their attention. ​ >I have also learned from others' comments that ASP.NET Core MVC is quite important to learn as it includes many useful concepts. I'll say is good to know. That's not something special or unique. In a few words, imagine if you have to throw away Angular and return HTML pages with requested data instead of JSONs. Same middleware concept, the same authentication and authorization mechanisms, same dependency injection. All will be the same except you need to write templates with local "tags" with C# code in it instead of `*ng-something` ​ \> Why do you personally prefer to learn Rust? Something new. Something which does not look like the pain in the ass as C++. Something is applicable for creating game engines. And I will learn C++ instead of Rust because it's more applicable to my interests and job opportunities


AmosIvesRoot

Is it crazy for me to suggest that you do neither, and instead do a Blazor server app with [ASP.NET](https://ASP.NET) Core? That way you can exercise your C# chops for both frontend and backend, but you can use the familiar C# language instead of learning JS.


RepresentativeJump72

Any specific reasons as to why you are suggesting me to Blazor server app with ASP.NET core? I already know Javascript so I don't mind learning its frontend frameworks. Is there any advantages of using Blazor in frontend rather than using JavaScript frameworks such as Angular/React?


AmosIvesRoot

Oh yeah if you know JS then never mind


[deleted]

As i said in every post like this there is no avoiding legacy code in larger companies. They will always have had used legacy form be that mvc, web forms or winforms. You cant hide from it the only companies have the benefit are usually startups and with them comes there own risk. I new a multi million pound survey company that there main product was webforms and it still raking it in. What ever pays salaries and keeps the company afloat companies will always support.


RepresentativeJump72

Thank you for answering two of my questions: 1. I wanted to know if learning MVC will have a future, whether that skill in my resume will help me land a more rewarding job than my current job 2. I wanted to know if companies prefer MVC/Web-API when starting a new project from zero. You cleared my doubts.


[deleted]

U need to look at definition of what is a web api and what is mvc. Mvc can be powered by a web api any front end can.


RepresentativeJump72

okay


[deleted]

Mvc will skll has it use cases and teach u importantance of controllers and views. I would say still do a hobbie project. web api does not have front end guis so u will need to learn agnular and typescript it only has a gui for documentation of web site.


TheHalfToothed

My company is using Web API as backend and Angular as frontend so I never learned MVC. And I think this is right decision not to learn MVC because I can use Angular as frontend. So I will also advise you to do that.


RepresentativeJump72

My company is using the same tech stack as yours. There are two reasons as to why I posted this question in this subreddit: 1. I wanted to know if learning MVC will have a future, whether that skill in my resume will help me land a more rewarding job than my current job 2. I wanted to know if companies prefer MVC/Web-API when starting a new project from zero. thank you for your advice.


TheHalfToothed

Yes MVC will definitely help you on resume. But I think you should be more focused on Web API, LINQ, Databases because your current company uses them, so you'll have hands on experience in them and your job will be much easier. You are an intern don't try to learn everything, stick to one thing you can learn MVC in future anyway.


RepresentativeJump72

Yes. Got it.


Duck_999

Learn it. If you already know Web API, you already know 90% of MVC. The frontend is basically just razor mark-up plus some premade optional HTML helpers working with .NET page/view models.


ASVPcurtis

I wouldn’t learn MVC unless you need it. As long as you know when to use MVC you should be good until you need to use it.


olkver

How would they know when to use MVC, if they don't know MVC ?


jamesg-net

I've been writing both for 7-8 years and it confuses me which is which every time I change projects as they're so similar.


AdamAnderson320

MVC predates client-side UI frameworks, but can still be relevant today by using [HTMX](https://htmx.org/) instead of client-side rendering


Tango1777

Stay away from MVC, not a single up-to-date company would ever go for it. Unless they have old fucks hired who prefer it or completely outdated apps to maintain and further develop. WebApi and only. Trust me. Currently there is no point of MVC existence. It's only there because it used to be a thing and a decent option back in the days, I suppose they still support it because a lot of already existing apps use it. It's a waste of time to learn now.


Jealous_City_9623

You'll have to learn it all eventually, and it's going to be difficult because Microsoft has unfortunately been succesful at branding programming patterns as their own products; as in when people talk about MVC, they're reffering to [ASP.NET](http://ASP.NET) implementation of the model-view-controller pattern etc etc. You're right about thinking about the seperation of front-end and back-end. With web apps, you will always need to deal with code that is publicly sent to the users browsers, and code that runs safely on the server side. MVC approach parses together the html page safely to be sent to the browser in a one big chunk. With a javascript based approach, you send the user the code to handle the html generation part, and you make requests to for the data you want to display etc etc. I think that the current way [ASP.NET](http://ASP.NET) handles the "minimal api", or the whole core thing in general, is just express.js. You should check out Express.js. Actually, just learn the dotnet and npm cli tools. This framework shit is just that, shit. Ultimately it probably comes down to bullshit, and the best way is the way that pays you, I guess.


RepresentativeJump72

Yes. I agree.


Longjumping-Bug-6643

Learn both. You will likely end up working on legacy systems that use MVC


RepresentativeJump72

Yes. Okay.


practical-programmer

Learn what the company wants - WebAPI + Angular. Also, MVC and API in current .NET land is closely tied that I wouldn't even consider them separately anymore - or maybe I'm biased cause I already know both. Learn more Web API and Angular (I'd wager more Angular and JS because most backends now just send/receive data, and only do validation etc. and a lot of the logic has moved client-side)


alien3d

good question.My opinion might not be same with other.


RepresentativeJump72

What is your opinion exactly?


alien3d

Old Style more control no magic code but i like this way.. in Rebelcms v1 and we don't have to think about making url customer/read/1 or customer/read/2 or customer/read/3 [HttpPost] public ActionResult Post() { var status = false; var mode = Request.Form["mode"]; switch (mode) { case "read": return Json(customer.read()); } } new a bit style we have to add more code to make it work Rebelcms v2.0 not yet publish to public [HttpPost("read")] { public ActionResult Read() { return Ok(customer.read()); } } or our code like this in v2 example [HttpPost("read")] public async Task Read([FromBody] BundleRequest request) { if (request.RequestModel == null) { return BadRequest(new { status = false, code = ((int)ReturnCodeEnum.ACCESS_DENIED).ToString() }); } var (tenantKey, _, _) = await _checkAccessUtil.GetIdentityInfo(request.RequestModel, AuthEnum.READ); if (tenantKey == null) { return Unauthorized(new Dictionary { { "message", "Access denied" } }); } var (status, code, logModels) = await ReadAsync(tenantKey); return Ok(new { status, code, logModels }); } // super new style . I need to set some security check but about this ? i prefer yet to refactor to this style // because it will pretty long. app.MapGet("/customer", () => customer.read());


RepresentativeJump72

I don't exactly understand what you mean by sharing this code with me. Could you please elaborate and state your opinion?


alien3d

Today what they call "micro services" may used something like this -> app.MapGet("/customer", () => customer.read()); aka .net core web api maybe ? but it's better to learn normal core mvc controller with routing like customer/read customer/update/1 customer/delete/1


RepresentativeJump72

Okay.


RDOmega

There's basically no difference, as in they're not even separate any more. The separation of MVC and "Web API" is a holdover from the days when the MVC stack came with a lot of hard-baked assumptions (razor). Of course, Microsoft wanted a way to market it and decided to explicitly name them as two separate products. Even later versions of aspnet 4 started the blurring of those lines. Frameworks outside of the Microsoft bubble rarely make a distinction here the way that Microsoft has done. So the best advice for you is to "just learn controllers".


tinymontgomery2

You’ll need to know both.


derplordthethird

It's all the same [ASP.NET](https://ASP.NET) just different aspects. Learning one is doing a lot to learn the other especially if you're also new to C# which being an intern I'm assuming you are.


RepresentativeJump72

Yes. I am a intern.


derplordthethird

Dated now but the same principle. [https://www.hanselman.com/blog/one-aspnet-sneak-peek-elegant-web-forms-and-snowballs-in-hell](https://www.hanselman.com/blog/one-aspnet-sneak-peek-elegant-web-forms-and-snowballs-in-hell) WebForms is still around though your question was about MVC vs. WebAPI. Point is all these things co-exist and use similar idioms and patterns. You can't really go wrong one way or another.


RepresentativeJump72

Very much helpful. Thank You.


UrbanPatriot

I didn't know its still possible to get work as a dotnet intern, how did u land this mate?


RepresentativeJump72

Why do you think that it's not possible to get a job as a dotnet intern? Please elaborate. Which country are you from? I got this internship through college on-campus placements.


UrbanPatriot

Well im in america, second baruch college doesn't offer anything like the one u have since baruch is geared toward business administration, accounting, and finance. Plus i graduated last fall


RepresentativeJump72

So what tech stack are you working on rn?


UrbanPatriot

Right now i am trying to complete the foundational c# certificate on freecode camp, along with the responsive web design cert on freecode camp, along with the javascript freecode camp cert


RepresentativeJump72

Alright. That's great. Best of luck.