public ActionResult EditStoreManager(StoreManagerViewModel obj) { StoreManager editStoreManager = SetInformation(obj.storeManager); bool bUpdate = StoreManagerBUS.Update(editStoreManager); if (bUpdate) { ViewData["message"] = "Lưu thành công!..."; return RedirectToAction("RequestList", "Admin"); } else { ViewData["message"] = "Có lỗi xảy ra!..."; } /// ===================== List<object> lstNewRoles = new List<object>(); List<object> lstNewState = new List<object>(); List<InternetAccessRole> lstRoles = InternetAccessRoleBUS.GetArray().ToList(); List<StoreManagerState> lstState = StoreManagerStateBUS.GetArray().ToList(); foreach (var m in lstState) { lstNewState.Add(new { Id = m.Id, Code = m.Code.Trim() + " - " + m.Name }); } foreach (var m in lstRoles) { lstNewRoles.Add(new { Id = m.Id, Code = m.Code.Trim() + " - " + m.Name }); } obj.storeManagerStates = lstNewState; obj.internetAccessRoles = lstNewRoles; return View(obj); }
/// <summary> /// Accept, denied the Store's request /// </summary> public ActionResult EditStoreManager(int id) { List<object> lstNewRoles = new List<object>(); List<object> lstNewState = new List<object>(); List<InternetAccessRole> lstRoles = InternetAccessRoleBUS.GetArray().ToList(); List<StoreManagerState> lstState = StoreManagerStateBUS.GetArray().ToList(); foreach( var m in lstState) { lstNewState.Add(new { Id = m.Id, Code = m.Code.Trim() + " - " + m.Name }); } foreach (var m in lstRoles) { lstNewRoles.Add(new { Id = m.Id, Code = m.Code.Trim() + " - " + m.Name }); } var model = new StoreManagerViewModel { storeManager = SetManagerBaseInfo(StoreManagerBUS.GetItem(id)), internetAccessRoles = lstNewRoles, storeManagerStates = lstNewState }; return View(model); }