public virtual ActionResult Create(DepartView depart) { try { if (ModelState.IsValid) { var newDepart = new Depart(); if (TryUpdateModel(newDepart)) { Repository.Add(newDepart); Repository.Save(); return null; } return Content("不能保存此部门"); } return Content("部门输入信息不符合规定"); } catch { return Content("出错了"); } }
private void FixupDepart(Depart previousValue) { if (Depart != null) { if (DepartId != Depart.DepartId) { DepartId = Depart.DepartId; } } else if (!_settingFK) { DepartId = null; } }