Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MVC, WebAPI Controllers and LocalStorage
Message
De
03/07/2014 09:53:38
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
MVC, WebAPI Controllers and LocalStorage
Versions des environnements
Environment:
C# 4.0
OS:
Windows 8
Network:
Novell 6.x
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01603183
Message ID:
01603183
Vues:
62
Hi,

I am starting to work on using Local Storage for my ASP.NET MVC/Web API application.

The application allows a user when in the office to select the run sheet (list of packages to be delivered) and then a copy of all the data for that run sheet gets stored in the local storage of the browser. The user then delivers all the packages, recording the deliveries in local storage and upon returning to the office all the deliveries are transferred from local storage to the database on the server. Or at least that is how it is supposed to work. :)

My problem is that I am getting all the run sheet details from the database and displaying them no problem the first time using his code:
        public ActionResult Index(Guid id)
        {
            RunSheetDetailsListViewModel vm = new RunSheetDetailsListViewModel();
            var query = this._unit.RunSheetDetails.GetByRunSheetId(id); //.GetAll().OrderBy(rnh => rnh.Route.rte_name);
            vm.RunSheetDetails = query.ToList();

            return View("Index", vm);
        }
In my Index.cshtml I have this:
            var vm = new ViewModel();

            var serialized = JSON.stringify(vm.runSheetDetails());

            runsheetdetailsDataService.saveLocal(serialized);
in the jquery ready function.

This apparently saves the data properly in the local storage.

Now, when the user is not connected to the server, how do I tell the Index ActionResult to pull the data from local storage rather than the database?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform