AspNetCheckedListExample.Controllers.PeopleController.SubmitSelected C# (CSharp) Метод

SubmitSelected() приватный Метод

private SubmitSelected ( PeopleSelectionViewModel model ) : System.Web.Mvc.ActionResult
model AspNetCheckedListExample.Models.PeopleSelectionViewModel
Результат System.Web.Mvc.ActionResult
        public ActionResult SubmitSelected(PeopleSelectionViewModel model)
        {
            // get the ids of the items selected:
            var selectedIds = model.getSelectedIds();

            // Use the ids to retrieve the records for the selected people
            // from the database:
            var selectedPeople = from x in Db.People
                                 where selectedIds.Contains(x.Id)
                                 select x;

            // Process according to your requirements:
            foreach(var person in selectedPeople)
            {
                System.Diagnostics.Debug.WriteLine(
                    string.Format("{0} {1}", person.firstName, person.LastName));
            }

            // Redirect somewhere meaningful (probably to somewhere showing
            // the results of your processing):
            return RedirectToAction("Index");
        }
PeopleController