Exemplo n.º 1
0
        private async Task SaveDataAsync()
        {
            var user = _conn.TUsers.Where(u => u.Email.Equals(Email)).ToList();

            if (user.Count.Equals(0))
            {
                if (avatar == null)
                {
                    _bitmapImage.UriSource = new Uri("ms-appx:///Assets/StorageLogo.scale-400.png");
                    avatar = await _uploadImage.ImagebyteAsync(_bitmapImage);
                }
                _conn.TUsers.Value(u => u.NID, Nid)
                .Value(u => u.Name, Name)
                .Value(u => u.LastName, LastName)
                .Value(u => u.Telephone, Telephone)
                .Value(u => u.Email, Email)
                .Value(u => u.Password, Encrypt.EncryptData(Password, Email))
                .Value(u => u.Users, User)
                .Value(u => u.Role, SelectedRole)
                .Value(u => u.Date, DateTime.Now.ToString("dd/MMM/yyy"))
                .Value(u => u.Images, avatar)
                .Insert();
                App.mContentFrame.Navigate(typeof(Usuarios));
            }
            else
            {
                UserTittle = "El email ya esta registrado";
                _textBoxEmail.Focus(FocusState.Programmatic);
            }
        }