using System.Collections.Generic;
namespace HelloWorldMvcApp
public class HomeController : Controller
static string dataUrl = "https://www.tailorsoft.co/sample.json";
public ActionResult Index()
ExampleVM model = new ExampleVM();
GridToShow Grid = new GridToShow();
List<Table> Table = new List<Table>();
using (WebClient wc = new WebClient())
var json = wc.DownloadString(dataUrl);
model = JsonConvert.DeserializeObject<ExampleVM>(json);
for (int i = 0; i <model.products.Count; i++)
while (posOrder < model.orders.Count && model.orders.Any())
while(posItems < model.orders[posOrder].items.Count && model.orders[posOrder].items.Any())
if (model.products[i].id == model.orders[posOrder].items[posItems].productId)
totalQuantity += model.orders[posOrder].items[posItems].quantity;
model.orders[posOrder].items.RemoveAt(posItems);
if (!model.orders[posOrder].items.Any())
model.orders.RemoveAt(posOrder);
name = model.products[i].name,
totalPrice = float.Parse(model.products[i].price) * totalQuantity