Esempio n. 1
0
        public bool Validate()
        {
            ValidationErrors.Clear();
            RaisePropertyChanged(() => ValidationErrors);

            var validationResults = _validateRequest.Validate <Session, SessionValidator>(new Session
            {
                Venue       = Venue,
                SessionDate = SessionDate,
                Game        = SelectedGame
            });

            if (!validationResults.IsValid)
            {
                foreach (var error in validationResults.Errors)
                {
                    if (!ValidationErrors.ContainsKey(error.Key))
                    {
                        ValidationErrors.Add(error.Key, error.Value);
                    }
                }

                RaisePropertyChanged(() => ValidationErrors);

                return(false);
            }

            return(true);
        }