public IActionResult Edit(int id) { var palletViewModel = palletManager.GetById(id); var editPalletViewModel = new EditPalletViewModel() { STATUSES_INFO = statusManager.GetAll(), ID = palletViewModel.ID, IP = palletViewModel.IP, NAME = palletViewModel.NAME, STATUSID = palletViewModel.STATUSID, STATUS_NAME = palletViewModel.STATUS_NAME }; return(View(editPalletViewModel)); }
public IActionResult Edit(EditPalletViewModel model) { if (ModelState.IsValid) { var palletViewModel = new PalletViewModel() { ID = model.ID, IP = model.IP, NAME = model.NAME, STATUSID = statusManager.GetAll().FirstOrDefault(x => x.NAME == model.STATUS_NAME).ID, STATUS_NAME = model.STATUS_NAME }; palletViewModel = palletManager.Update(palletViewModel); return(RedirectToAction("List")); } return(View(model)); }