public void EnsureMakeCouponGiftIsValid(string text, string friendEmail) { List <ValidationError> errors = new List <ValidationError>(); try { var ms = _configurationBll.Get(); _validationBll.EnsureTextLength(text, ms.MinGiftCongratulationsLength, ms.MaxGiftCongratulationsLength); } catch (ValidationException vex) { vex.Error.FieldName = "text"; errors.Add(vex.Error); } catch (ArgumentNullException anex) { errors.Add(new ValidationError(ValidationErrors.Empty, anex.Message, "text")); } catch (Exception ex) { errors.Add(new ValidationError(ValidationErrors.RuleViolation, ex.Message, "text")); } _validationBll.IsEmailValid(friendEmail, true, errors); foreach (var e in errors.Where(x => x.FieldName != "text")) { e.FieldName = "friendEmail"; } if (errors.Count > 0) { throw new ValidationListException("Incorrect coupon to gift parameters", errors); } }
public User WebLogin(string email, string password) { var errors = new List <ValidationError>(); if (_validationBll.IsEmailValid(email, true, errors) == false) { throw new ValidationListException("E-mail is incorrect", errors); } var u = _users.First(x => x.Email.Equals(email, StringComparison.OrdinalIgnoreCase) && x.Password.Equals(password)); return(u); }