Exemplo n.º 1
0
        /// <summary>
        /// Constructeur
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="mapper"></param>
        public ProfileInformationsViewModel(ILibraryRepository repository, IMapper mapper)
            : base(repository, mapper)
        {
            Genders = new(GendersData.GetGenders());

            LoadCommand   = new(async() => await LoadAsync());
            ModifyCommand = new(async() => await Modify());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructeur
        /// </summary>
        /// <param name="repository">ILibraryRepository</param>
        /// <param name="mapper">IMapper</param>
        /// <exception cref="ArgumentNullException">
        /// Si repository ou mapper sont null
        /// </exception>
        public RegisterViewModel(ILibraryRepository repository, IMapper mapper)
            : base(repository, mapper)
        {
            UserRegistration = new();
            Address          = new();

            Genders = new(GendersData.GetGenders());

            RegisterCommand = new(async() => await Register());
        }
Exemplo n.º 3
0
        public ChangeResult <string> DefineGender(string newValue)
        {
            if (newValue is null)
            {
                return(ChangeResult <string> .Failed(this, Properties.Gender, "Le genre est requis !", m_Gender, newValue));
            }
            newValue = newValue.Trim();
            if (newValue.Length != 5)
            {
                return(ChangeResult <string> .Failed(this, Properties.Gender, "Le genre doit faire exactement 5 caractères !", m_Gender, newValue));
            }
            else if (!GendersData.GetGenders().Any(x => x.Equals(newValue)))
            {
                return(ChangeResult <string> .Failed(this, Properties.Gender, "Le genre rentré n'existe pas !", m_Gender, newValue));
            }

            newValue = newValue.ToLower().FirstCharToUpper();
            var initialValue = m_Gender;

            m_Gender = newValue;
            return(ChangeResult <string> .Succeded(this, Properties.Gender, initialValue, newValue));
        }