private List<Pricing> pList() { Prices prices = new Prices(); List<Pricing> prs = prices.Pricelist; return prs.ToList(); }
private void calculateHardCoded(int totalPackages, int totalKG) { if (ModelState.IsValid) { try { Prices prices = new Prices(); List<Pricing> prs = prices.Pricelist.ToList<Pricing>(); if (totalPackages != 0 && totalKG != 0) { var model = prs.Where(p => p.Weight == totalKG && p.NumberOfPackages == totalPackages).First(); ViewBag.Weight = model.Weight; ViewBag.NumberOfPackages = model.NumberOfPackages; var pr = model.Price + 10; ViewBag.Price = pr; } } catch (Exception exp) { Console.WriteLine(exp.Message); } } }