Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
i am using rest api to fetch and save the data in database using jquery or angularjs, but i want to ask you about which approach is best for doing this.
using jquery to post the data
using angularjs to post the data
using c# code behind to post the data using mvc.
performance and security wise which is best.
There is no 'best' way to do this, but I'd suggest implementing your RESTful API using ASP.NET Web API and then consuming that with AngularJS on the front-end (using the $http service). It's a pretty neat way of communicating with your APIs without having to navigate away from the page, as you would have to do if it was all implemented using ASP.NET MVC.
But then I suppose it depends what you're actually implementing, does it make sense to navigate away from a page after creating or updating something? If you're creating entities from a HTML form then it would make sense to navigate the user to a completely different page after creating/updating. But if you're doing something different like changing the order of entities in a list, consuming a RESTful API without navigating away from the page would make sense.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
What is the main feature of Microsoft's .Net Blazor? Can we use it in place of React or Angular? Will Blazor provide all the tools which are provided in Angular or React?
In my opinion the main advantages of using Blazor instead of React or Angular are:
C# and ASP.NET can be used both on the client and server-side. Currently the cost of switching is high (imho) and removing the need for JavaScript libraries would reduce this. It is more or less the same argument for using Node.js on the server-side. But in the case of Blazor you remove JavaScript in favour for C# and ASP.NET. Who does not like that? :)
You can use shared models (or even functional code) that will reduce duplicate code, will save time and prevent mistakes caused by client-server model mismatch.
It is correct that Blazor and Angular/React are in fact not the same thing. Blazor generates WebAssembly and React/Angular do not (currently). However, the first two arguments are still valid if you are thinking of replacing Angular/React with Blazor. Just keep in mind that Blazor is still not fully supported and does not have all the features that the Javascript libraries have.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm a starter in web developing, weak at php-js-css but have c# experience.
For a new website project I want to use c# but have some problems with the view.
I won't use those standard-looking webform controls that I use for desktop apps, I need a better and modern appearance, a "Bootstrap-like view" for webform controls.
My goal is:
To be not having to learn js-css in detail for this website project, since it will take extra time for me to learn these. I want to solve this problem with c# compatible and easy to use tools / frameworks if possible.
For this purpose:
can I use a such a recommended framework class with c#,
or could just a css template do it,
or is there a 3rd simpler way
It is important for me to choose the right way before I start the project, any help is appreciated.
You absolutely can. You need to use javascript or typescript for the UI and then use Asp.Net WebApi to do any of the server-side functionality. Any of the popular javascript frameworks play very well with WebApi as long as you create the endpoints the correct way.
Here are some tutorials that can help get you started:
Hands On Lab: Build a Single Page Application (SPA) with ASP.NET Web API and Angular.js
AngularJS CRUD Operations with WebAPI, EF and Bootstrap
ASP.NET Web API application with Angularjs Forms and Bootstrap
Creating your first SPA Application using AngularJS and WebAPI – All CRUD Operations
Pluralsight also has a number of video tutorials that are well worth the cost if you can afford it.
Hope that helps.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I'm asking this just to see experiences from others.
For most of the cases having ASP MVC web site is an overhead. At least for me it's much cleaner and easier to have WebAPI which responds with JSON and then you can attach either SPA application or Mobile app or whatever.
I have a feeling that if you are using ASP MVC controllers will not be controllers, but controllers full of the if conditions and some session bags which are hanging around. Views are combination of HTML and Razor which in most cases looks really ugly and full of "TODOs" ;)
I can understand if it's used in older projects and now we just need to maintain them. But when you are starting a new one, why you would choose ASP.NET MVC or any other similar framework?
In my opinion, it is all about your expectations - if you need REST you should take WebAPI of course, but in case of RPC Style Actions requirements in your project, MVC will be better choice
It depends on the resources available. If you have a team already that is doing all pure UI (all request/response to the backend is via a RESTful API), then you can have those team create the UI for you and you can focus on the API. These UI applications are mostly client-facing products.
But sometimes in your team there is a need to develop in-house or internal applications such admin/operations applications, and the UI requirement is not as sophisticated , the teams skillset is not heavy on UI, and there is a need to develop the application ASAP, then I would go with MVC.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am working with a ASP.NET MVC website and ASP.NET Web Api service. Current architecture looks like this
Browser => UI website => Web Api service => databases
The argument to split UI and Web Api was so that we can have several different UIs (Web, Mobile, Desktop, watches, etc) all calling intermediate service to get data. However, when I need to add a new api call i need to add quite a bit of plumbing boilerplate code (+ boilerplate tests which I dislike even more).
Browser => ajax
UI => controller and web api proxy client
Web API => controller and repository
database
I am thinking, it would have been easier to combine web api with UI, as I won't need to write additional controllers and proxy to call it, however I am not sure if this is the right way to go. We have about 20 controllers and 100 api calls written in C#. I am interested to know how other people use web api together with UI projects.
Should I merge Web Api project with UI project and what are the pros and cons of doing so?
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have an Asp.net web application. I have to use javascript to insert data on the same local machine, where I'm already using a 3-tier architecture and Stored procedures.
My question is:
Is there a way to insert data starting from javascript ?
please explain how this can be done ?
Thanks!!
Obviously, you'll have to traverse all your tiers. You may use AJAX on the client and have an ASMX on the receiving end which actually inserts the data. Pay attention to authentication and security, attackers might send an HTTP request to the ASMX directly.
Alternatively, you'll have to post back your data through a form. Javascript does not contribute much here, in my opinion.
Now that I've read your later comments I see that it's all on your local machine.
Read about HTML5 and local storage, maybe this is what you need:
http://diveintohtml5.info/storage.html
Using ajax and webmethod you can able to insert the data.
Click here to know more
There are several ways to achieve this but my suggestion is:
In client side you can use:
JQuery methods to submit your data ($.post or $.ajax) see this link
In server side you can use:
web services that send/receive json requests see this tutorial
Remeber that with javascript the preferable way to send and receive data is using JSON data format.