mirror of
https://github.com/rudollee/LearningMVC.git
synced 2025-06-07 16:06:21 +00:00
LINQ 3
This commit is contained in:
parent
496c391fd0
commit
58d04197ee
@ -143,5 +143,22 @@ namespace LanguageFeatures.Controllers
|
||||
|
||||
return View("Result", (object)result.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public ViewResult SumProducts()
|
||||
{
|
||||
Product[] products =
|
||||
{
|
||||
new Product {Name = "Kayak", Category = "Watersports", Price = 275M },
|
||||
new Product {Name = "Lifejacket", Category = "Watersports", Price = 48.95M},
|
||||
new Product {Name = "Soccer ball", Category = "Soccer", Price = 19.50M },
|
||||
new Product {Name = "Coner flag", Category = "Soccer", Price = 34.95M }
|
||||
};
|
||||
|
||||
var results = products.Sum(e => e.Price);
|
||||
|
||||
products[2] = new Product { Name = "Stadium", Price = 7950M };
|
||||
|
||||
return View("Result", (object)String.Format("Sum: {0:c}", results));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user