Example #1
0
        private async Task <bool> Eliminar()
        {
            bool   borrado   = false;
            String matricula = textMatricula.Text;

            try
            {
                if (!(await _repositorioVehiculo.TieneAlquileresAsignados(matricula)))
                {
                    borrado = await _repositorioVehiculo.Borrar(matricula);
                }
                else
                {
                    MessageBox.Show("No se puede borrar este vehĂ­culo" +
                                    " porque tiene alquileres asignados");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(borrado);
        }