protected override void Execute(RuleContext context) { var target = (IUser)context.Target; var users = UserInfoList.FetchUserInfoList(new UserCriteria { Email = target.Email }); if (users.Count(row => row.UserId != target.UserId) != 0) { context.AddErrorResult("That email address is already in use."); } }
protected override void Execute(RuleContext context) { var target = (IUser)context.Target; if (string.IsNullOrEmpty(target.Email)) { return; } var data = UserInfoList.FetchUserInfoList(new UserDataCriteria { Email = target.Email }); if (data.Count(row => row.UserId != target.UserId) != 0) { context.AddErrorResult(string.Format("The user email '{0}' is already in use.", target.Email)); } }
public static UserInfoList UserFetchInfoList(UserDataCriteria criteria) { return(UserInfoList.FetchUserInfoList(criteria)); }