Note that there are some explanatory texts on larger screens.

plurals
  1. PORefresh View in MVC asp.net
    text
    copied!<p>I have a view which has different sections displaying different type of orders from DB (SQL Server). Now I need to refresh view with updated information each time a new order is submitted through Android Application. Below are code snippets:</p> <p>ViewModel:</p> <pre><code>public class KitchenViewModel { public List&lt;Orders&gt; DisplayOrders { get; set; } public List&lt;Orders&gt; PreparedOrders { get; set; } public List&lt;OrderItem&gt; ProgressItems { get; set; } public List&lt;OrderItem&gt; QueuedItems { get; set; } public int DisplayOrdCount { get; set; } public int PreparedOrdCount { get; set; } public int QueuedOrdCount { get; set; } } </code></pre> <p>Controller:</p> <pre><code>public ActionResult KitchenOrder() { KitchenModel kitchenInstance = new KitchenModel(); List&lt;Orders&gt; orders = kitchenInstance.GetProgOrdersList(); List&lt;OrderItem&gt; progressItems = kitchenInstance.GetItemProgress(); List&lt;OrderItem&gt; queuedItems = kitchenInstance.GetItemQueued(); List&lt;Orders&gt; prepOrders = kitchenInstance.GetPrepOrdersList(); List&lt;Orders&gt; queuedOrders = kitchenInstance.GetQueuedOrdersList(); KitchenViewModel viewModel = new KitchenViewModel(); viewModel.PreparedOrders = prepOrders; viewModel.ProgressItems = progressItems; viewModel.DisplayOrders = orders; viewModel.QueuedItems = queuedItems; viewModel.DisplayOrdCount = orders.Count; viewModel.PreparedOrdCount = prepOrders.Count; viewModel.QueuedOrdCount = queuedOrders.Count; return View(viewModel); } </code></pre> <p>As of now I am auto refreshing view after every 15 seconds which is working perfectly. But I need to refresh view only when a new order is submitted through Android application and order is inserted in DB. Once a new order is submitted the values for PreparedOrders, Progressitems, DisplayOrders gets changed and need to be fetched again. I have read many posts/tutorials relating to Observer pattern and publisher/subscriber method but unable to get crisp solution which would fit best. Could someone please provide relevant pointer/tutorial to use in such a scenario that could help. Being this my very first project and a total beginner, I m quite confused as in how to proceed.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload