Exemplo n.º 1
0
        private async void CreateClientBtn_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var createDialog = await CreateClientDialog.ShowAsync();

            if (createDialog == ContentDialogResult.Primary)
            {
                var newClient = new ClientDTO();
                newClient.Name           = nameTxb.Text;
                newClient.LastName       = lastNameTxb.Text;
                newClient.Identification = identificationTxb.Text;
                newClient.Birthday       = birthDayDt.Date.DateTime;
                newClient.LastVisit      = DateTime.Now;
                newClient.Email          = mailTxb.Text;
                await rest.PostAsync(newClient, Common.CreateClientURI);
            }
            GetClients();
            ClearForm();
        }
Exemplo n.º 2
0
        private async void editBtn_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var client = ClientList.FirstOrDefault(b => b.Id == int.Parse(((Button)sender).Tag.ToString()));

            nameTxb.Text           = client.Name;
            lastNameTxb.Text       = client.LastName;
            identificationTxb.Text = client.Name;
            birthDayDt.Date        = client.Birthday;
            mailTxb.Text           = client.Email;
            var createDialog = await CreateClientDialog.ShowAsync();

            if (createDialog == ContentDialogResult.Primary)
            {
                client.Name           = nameTxb.Text;
                client.LastName       = lastNameTxb.Text;
                client.Identification = identificationTxb.Text;
                client.Birthday       = birthDayDt.Date.DateTime;
                client.Email          = mailTxb.Text;
                await rest.PutAsync(client, Common.UpdateClientURI);
            }
            ClearForm();
            GetClients();
        }