private async void btStart_Click(object sender, RoutedEventArgs e)
        {
            Camarero camarero = new Camarero();

            tblStatus.Text = "Llegue al bar";
            var waitTask = camarero.Wait();

            waitTask.Start();
            await waitTask;

            tblStatus.Text = "Me sente junto a mi amigo";
            waitTask       = camarero.Wait();
            waitTask.Start();
            await waitTask;

            tblStatus.Text = "Pedi una cerveza";
            waitTask       = camarero.Wait();
            waitTask.Start();
            await waitTask;

            tblSay.Text = DateTime.Now.ToString();
            var task = camarero.ServeBeer("Root Beer");

            task.Start();
            tblStatus.Text = "Charlando";
            var beer = await task;

            tblGet.Text    = DateTime.Now.ToString();
            tblStatus.Text = "Brindando";
        }
コード例 #2
0
        public async Task <string> InsertAsync(Camarero model)
        {
            using (var connection = _connectionFactory.GetConnection)
            {
                var query      = "uspCamareroInsert";
                var parameters = new DynamicParameters();

                parameters.Add("Nombre", model.Nombre);
                parameters.Add("Apellido1", model.Apellido1);
                parameters.Add("Apellido2", model.Apellido2);

                var result = await connection.QuerySingleAsync <string>(query, param : parameters, commandType : CommandType.StoredProcedure);

                return(result);
            }
        }
コード例 #3
0
 public async Task <string> UpdateAsync(Camarero model)
 {
     return(await _Repository.UpdateAsync(model));
 }
コード例 #4
0
 public async Task <string> InsertAsync(Camarero model)
 {
     return(await _Repository.InsertAsync(model));
 }