示例#1
0
        public string AddRole(Material_Role materialRole, List <int> actions)
        {
            Material_Role updateRole = _roleBll.Find(materialRole.Id);

            if (updateRole == null)
            {
                return(_roleBll.AddEntities(new List <Material_Role> {
                    materialRole
                }) &&
                       _roleActionBll.SetActionByRole(actions, materialRole.Id) ? "添加成功" : "添加失败");
            }
            else
            {
                AssmblyHelper.ClassEvaluate(materialRole, updateRole);
                return(_roleBll.UpdateEntities(new List <Material_Role> {
                    updateRole
                }) && _roleActionBll.SetActionByRole(actions, updateRole.Id) ? "更新成功" : "更新失败");
            }
        }