// QxJzxt/OrgCRUD/Add_Org_Position public ActionResult Add_Org_Position(string orgid) { if (orgid.HasValue()) { int index = orgid.IndexOf('!'); var orgnization_id = orgid.Substring(0, index); InitForm("为组织机构添加职位"); var org = _orgnization.Find(orgnization_id); var positionSelect = _position.ToSelectItems(); return(View(Org_Position_M.ToViewModel(orgnization_id, positionSelect, org))); } else { return(Alert("参数请求错误")); } }
public ActionResult Add_Org_Position(Org_Position_M model) { try { if (!_IOrgService.FindPositionIsRelationOrg(model.orgnization_id, model.position_id)) { var result = _orgnization_position.Add(model.ToModel()); return(result.HasValue() ? RedirectToAction("Org_Position", "Org", new { area = "QxJzxt", Params = model.orgnization_id }) : Alert("添加失败")); } else { return(Alert("该组织机构已经添加过该职位了,请勿重复添加")); } } catch (FormValitationException ex) { FormValitation = ex; InitForm("为组织机构添加职位"); var positionSelect = _position.ToSelectItems(); var org = _orgnization.Find(model.orgnization_id); return(View(Org_Position_M.ToViewModel(model.orgnization_id, positionSelect, org))); } }