1234567891011121314151617181920212223242526272829303132333435363738394041 |
-
- using CZFW.Framework.Interface;
- using CZFW.Framework.Interface.Base;
- using CZFW.Framework.Model.Entity;
- using System.Linq;
- namespace CZFW.Framework.Logic
- {
- public class DictLogic : LogicBase<DictEntity>, IDict, IValidate<DictEntity>
- {
- public (bool result, string message) Validate(DictEntity entity)
- {
- if (entity.Id == 0)
- {
- var any = Queryable.Any(x => x.Mark == entity.Mark);
- return (!any, any ? "系统中已有该标识项目" : null);
- }
- else
- {
- var any = Queryable.Any(x => x.Mark == entity.Mark && x.Id != entity.Id);
- return (!any, any ? "系统中已有该标识项目" : null);
- }
- }
- }
- }
|