Assuming your ViewModel looks like this: public class ViewModel { IEnumerable lst { get; set; } // other properties } Just do this: public ActionResult GetMonies() { var monies = context. Money . Take(10) .ToList(); var model = new ViewModel { lst = monies }; return View(model); }.
IEnumerable has the ToList() function which returns a list of said type. Vm. Lst = context.Money.
Take(10).ToList(); // returns a List.
I would recommend you to prevent possibility of changing ViewModel. Lst, i.e. Lst's type should be IEnumerable instead of List/IList (of course if your further code doesn't require List functionality).
Furthermore, I suppose you don't modify lst reference, so you could remove setter and initialize lst via constructor. Public class ViewModel { public ViewModel(IEnumerable lst) { this. _lst = lst; } private readonly IEnumerable _lst; IEnumerable Lst { get { return this.
_lst; } } // other properties } public ActionResult GetMonies() { var model = new ViewModel(context.Money. Take(10).ToArray()); return View(model); } This approach guarantees that consumers of your code will not modify your ViewModel. Lst accidentally.
I would recommend you to prevent possibility of changing ViewModel. Lst's type should be IEnumerable instead of List/IList (of course if your further code doesn't require List functionality). Furthermore, I suppose you don't modify lst reference, so you could remove setter and initialize lst via constructor.
This approach guarantees that consumers of your code will not modify your ViewModel.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.