/// <summary> /// 删除职位 /// </summary> /// <param name="id"></param> /// <returns></returns> public JsonResult DeletePosition(string id) { int posId = int.Parse(id); Position posit = db.GetModel(posId); if (posit.Position2.ToList().Count() > 0) { return(Json("No")); } else { List <Employee> emps = db.GetPositEmp(posId); foreach (Employee emp in emps) { emp.PositionId = null; } db.Delete(posId); return(Json("Yes")); } }