public ActionResult Edit( [Bind(Include = "Id,CodeVO,Replace405,CodeVODesc,Code405Desc,OperationCodeRef,DirectionPay,IssuerNerez,IssuerRez,PropertyFlg,Include405,Include406, selectedCode405")] SettingCodeVO settingCodeVO, int[] selectedCode405 ) { if (ModelState.IsValid) { SettingCodeVO settingCodeVOUpdated = db.SettingCodeVOs.Find(settingCodeVO.Id); UpdateModel(settingCodeVOUpdated); settingCodeVOUpdated.CodeToolings.Clear(); if (selectedCode405 != null) { foreach (var c in db.CodeToolings.Where(co => selectedCode405.Contains(co.Id))) { settingCodeVOUpdated.CodeToolings.Add(c); } } db.Entry(settingCodeVOUpdated).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OperationCodeRef = new SelectList(db.DirectionPays, "Direction_Pay", "DescDirect", settingCodeVO.OperationCodeRef); return(View(settingCodeVO)); }
public ActionResult DeleteConfirmed(int id) { SettingCodeVO settingCodeVO = db.SettingCodeVOs.Find(id); db.SettingCodeVOs.Remove(settingCodeVO); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Directories/SettingCodeVOes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SettingCodeVO settingCodeVO = db.SettingCodeVOs.Find(id); if (settingCodeVO == null) { return(HttpNotFound()); } return(View(settingCodeVO)); }
// GET: Directories/SettingCodeVOes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SettingCodeVO settingCodeVO = db.SettingCodeVOs.Find(id); if (settingCodeVO == null) { return(HttpNotFound()); } ViewBag.OperationCodeRef = new SelectList(db.DirectionPays, "Direction_Pay", "Direction_Pay", settingCodeVO.OperationCodeRef); var selectedCode405 = settingCodeVO.CodeToolings.Select(item => item.Id.ToString()).ToArray(); MultiSelectList list = CodeToolingsList(selectedCode405); ViewBag.SectionRef = new SelectList(db.SettingCodeVOSections, "SectionNo", "SectionNo"); ViewBag.CtList = list; ViewBag.Title = "Изменить код (405/406)"; ViewBag.isEdit = true; return(View(settingCodeVO)); }