How Backbone.js with rest based service using Asp.NET MVC 4 - asp.net-mvc-3

I implemented some code using backbone.js in Asp.NEt MVC3 and found backbone.js very helpful. Actually I am developing the data warehouse application where user at view side can run/save his data analysis. And after relogin can re-run the saved analysis. On clicking the save button at toolbar system persist the analysis in DB.
My question is that can someone point links where backbone.js interacts with rest based service using Asp.NET MVC 4 so to save/retrieve the data in DB .
Please do advice me the better way as well.

I've built several very large systems on top of ASP.NET MVC4 and WebAPI, with Backbone, recently. I highly recommend WebAPI. It's very easy to use, and works very well with Backbone.
http://www.asp.net/web-api
As one example of an app that I've built with it:
https://ravenhq.com/
The registration, login, management, and account settings are all Backbone on top of WebAPI.

Related

Storing data at the client side in the asp.net c#

I am making one application. It is a web form based application in asp.net c#. I want to include one feature in which the user can save details which he has filled and then submit it later. It really confusing for me to apply any function.

ASP.NET Core Web API vs ASP.NET Core Application

First off, I apologise if this is a trivial question but I am getting so confused by the information I am reading. I have put off posting on here as I feel my question is too broad but I can't find a definitive answer. I am a C++ developer by trade but I am wanting to get into web development.
My end goal is to have a web API that is consumed by both a web app and mobile app. I want to get the structure nailed first by developing an web API and web app and then expand it to a mobile platform later on.
My aim is to have 4 separate sections - Database -> WebAPI -> Web App
-> Mobile App
all of which are protected with username/password etc.
I have decided to use ASP.NET Core but when creating an application I am given two options in visual studio - ASP.NET Core Application or Web API. I have tried creating a Web API and a separate Core Application but can't work out how to call the web API. I have also tried creating a Core Application as it seems like I should be able to do everything I want in one project but I am worried that the Web API won't be separated enough to be able to call from a mobile app.
I will be working with a database containing sensitive information so obviously want to protect access to the Web API and Web/Mobile app. I have been watching courses on Pluralsight about Identity but I have read that it doesn't work well with Web API's.
Basically I am getting extremely confused when in my mind my end goal should be relatively simple to achieve. If anyone could give me any pointers as to what technologies I need to use would be fantastic.
ASP.NET Core WebAPI is specifically designed for building REST-ful services.
ASP.NET Core Application is used to create web applications that returns both views and data (it's an analog of Asp.NET MVC from standard Framework).
Which to choose is really depends on kind of WebApp you are going to use. If you plan to use some SPA framework, you don't need mechanisms to generate views on server side - WebAPI is a great choice, otherwise choose Application. Here you can find more details on differences.
As of security concern, there no issues with WebAPI. It provides a lot of mechanisms to secure your API and restrict access to methods based on user's identity. Please look at this article as an example.

MVC .NET or WEB API

We want to write a new web site for customer using SQL DB
and implement only one specific client.
what the recommended technology to be used:
Peure MVC.net
Web API and client side using AJAX
I will be glad to hear the causes, the consideration and the cost.
Thanks!
I tend to favour a web api to handle all of the database work (via entity framework), but use MVC for my front end application.
This way you have all the flexibility of an API should you want to use different frameworks in the future (Angular, ASP.net 5 etc), but you can still have the pleasure of working MVC in your front end site.

MVC WebAPI with SPA

I am new to the WebAPI. I have 4 entities:
Location
Service
Item
Application
I have read several WebAPI tutorials. They all seem to have CRUD methods in each API Controller that deals with single entity. One functionality that I need is to simulate cascade dropdown and cascade update where Location determines range of Service. Each Service determines list of Service Item. Each Item may be used in a list of Application. The question is
Do I create 4 API Controllers with CRUD methods?
I need all 4 objects on one form as List Boxes that allow multi-selection.
Along side the 4 List Boxes, how to show a list of combination of selected value that are saved to a database table?
Which javascript library or framework is the best for SPA (Single Page App)? I am currently leaning towards Backbone.js and HotTowel.js.
Thank you.
You could expose your service as an OData service. If you wish to support filtering, then you should use the separate OData NuGet package, and develop your controllers. In this case four controllers would suit.
Then, you can use a client side rich data library such as breeze.js to make building requests to the OData service straightforward. You would then use an MV* client side framework to provide two way bindings between the client side view models and the UI elements.
Hot Towel isn't a JavaScript library, it's a Visual Studio extension which allows you to create a new project as a starting point for your SPA. The template requires Visual Studio 2012 and the ASP.NET Web Tools 2012.2 update.
It uses breeze.js, Knockout.js for the binding, and Durandal.js for navigation, life cycle, and view composition.

Server-Side State Management in ASP.NET MVC

I am in the process of migrating an ASP.NET web forms application to ASP.NET MVC 3. In my web forms project, we use the Application object to store some temporary information that we want to pass around on the server. We do not want to pass this information back to the client.
My question is, is there an equivalent to the Application object in ASP.NET MVC 3 to handle server-side state management?
Thank you!
Yes, the "object" is the same and can be accessed in a similar manner. MVC is built "on top of" ASP.Net so you can expect to have access to most of the same data structures like HttpContext.Session and HttpContext.Application.

Resources