/// <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()); }
/// <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()); }
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)); }