public ActionResult Edit(CunterEditModel model) { try { if (ModelState.IsValid) { var counterDal = new CHK_COUNTER_DAL(); var item = new CHK_COUNTER() { COUNTER_ID = model.CounterId, HALL_NO = model.HallNo, NOTE = model.Note, W1A_STAFF_ID = model.W1A_STAFF_ID, W1P_STAFF_ID = model.W1P_STAFF_ID, W2A_STAFF_ID = model.W2A_STAFF_ID, W2P_STAFF_ID = model.W2P_STAFF_ID, W3A_STAFF_ID = model.W3A_STAFF_ID, W3P_STAFF_ID = model.W3P_STAFF_ID, W4A_STAFF_ID = model.W4A_STAFF_ID, W4P_STAFF_ID = model.W4P_STAFF_ID, W5A_STAFF_ID = model.W5A_STAFF_ID, W5P_STAFF_ID = model.W5P_STAFF_ID, W6A_STAFF_ID = model.W6A_STAFF_ID, W6P_STAFF_ID = model.W6P_STAFF_ID, W7A_STAFF_ID = model.W7A_STAFF_ID, W7P_STAFF_ID = model.W7P_STAFF_ID, MODIFY_DTIME = DateTime.Now, MODIFY_ID = UserState.UserID }; var rst = counterDal.Update(item); if (rst > 0) { Alter("修改成功!", util.Enum.AlterTypeEnum.Success, false, true); return(Redirect("/Home/Blank")); } } setSatffSelectItem(model.HallNo); ModelState.AddModelError("", "修改失败。"); return(View(model)); } catch (Exception ex) { LogHelper.ErrorLog("修改出错!", ex); ModelState.AddModelError("", "修改失败!" + ex.Message); return(RedirectToAction("Error", "Home")); } }
public ActionResult Edit(string hallNo, int id) { try { var counterDal = new CHK_COUNTER_DAL(); var counter = counterDal.GetCounterByHallNoCounterId(hallNo, id); var item = new CunterEditModel() { CounterId = counter.COUNTER_ID, HallName = counter.HALL_NAM, HallNo = counter.HALL_NO, Note = counter.NOTE, W1A_STAFF_ID = counter.W1A_STAFF_ID, W1P_STAFF_ID = counter.W1P_STAFF_ID, W2A_STAFF_ID = counter.W2A_STAFF_ID, W2P_STAFF_ID = counter.W2P_STAFF_ID, W3A_STAFF_ID = counter.W3A_STAFF_ID, W3P_STAFF_ID = counter.W3P_STAFF_ID, W4A_STAFF_ID = counter.W4A_STAFF_ID, W4P_STAFF_ID = counter.W4P_STAFF_ID, W5A_STAFF_ID = counter.W5A_STAFF_ID, W5P_STAFF_ID = counter.W5P_STAFF_ID, W6A_STAFF_ID = counter.W6A_STAFF_ID, W6P_STAFF_ID = counter.W6P_STAFF_ID, W7A_STAFF_ID = counter.W7A_STAFF_ID, W7P_STAFF_ID = counter.W7P_STAFF_ID }; setSatffSelectItem(hallNo); return(View(item)); } catch (Exception ex) { LogHelper.ErrorLog("修改出错", ex); return(RedirectToAction("Error", "Home")); } }