// GET: GoodMovements public ActionResult Index() { var model = new GoodMovementSelectionViewModel(); foreach (var goodMovement in db.GoodMovement) { var editorViewModel = new SelectGoodMovementEditorViewModel() { ID = goodMovement.ID, ChangedBy = goodMovement.ChangedBy, Changed_Quantity = goodMovement.Changed_Quantity, Changed_Weight = goodMovement.Changed_Weight, doc_date = goodMovement.doc_date, entry_qnt = goodMovement.entry_qnt, entry_uom = goodMovement.entry_uom, gm_code = goodMovement.gm_code, material = goodMovement.material, move_reas = goodMovement.move_reas, move_type = goodMovement.move_type, mvt_ind = goodMovement.mvt_ind, plant = goodMovement.plant, po_item = goodMovement.po_item, po_number = goodMovement.po_number, pr_uname = goodMovement.pr_uname, pstng_date = goodMovement.pstng_date, ReasonForChange = goodMovement.ReasonForChange, ref_doc_no = goodMovement.ref_doc_no, SAP_quantity = goodMovement.SAP_quantity, stge_loc = goodMovement.stge_loc, Selected = true }; model.GoodMovements.Add(editorViewModel); } return(View(model)); }
public ActionResult SubmitSelected(GoodMovementSelectionViewModel 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 selectedGoodsMovement = from x in db.GoodMovement 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")); }