Exemple #1
0
        public async Task <int> SaveName(int userid, string name, string lastname, string patronymic, string birthday, string phone)
        {
            if (name == null || lastname == null || patronymic == null || birthday == null || phone == null)
            {
                return(1);
            }
            phone = phone.Replace("ϙ", "+");
            if (!ValidatePhone(phone))
            {
                return(2);
            }
            var profile = _profileRepository.Get().Where(i => i.Id == userid).ToList()[0];

            profile.Name       = name;
            profile.LastName   = lastname;
            profile.Patronymic = patronymic;
            profile.Birthday   = DateTime.Parse(birthday);
            var user = _usersRepository.Get().Where(i => i.Id == userid).ToList()[0];

            user.PhoneNumber = phone;
            await _profileRepository.SaveChangesAsync();

            await _usersRepository.SaveChangesAsync();

            return(0);
        }