Example #1
0
        public async void Delete(Gastos gastos)
        {
            var confirmacion = await dialogService.ShowMessageConfirmacion("Mensaje", "¿Desea borrar este elemento?");

            if (confirmacion)
            {
                var GastoAntiguo = ListaGastos.Find(x => x.GastosId.Equals(gastos.GastosId));
                dataService.Delete(GastoAntiguo);
                ListaGastos.Remove(GastoAntiguo);
                SumaGastoCategoria = ListaGastos.Where(x => x.Mes == Date.ToString("MMM", culture) &&
                                                       x.Anio == Date.ToString("yyyy", culture) &&
                                                       x.Categoria == SelectedItem).ToList().Sum(x => double.Parse(x.GastosCantidad)).ToString();
                SumaGasto = ListaGastos.Where(x => x.Mes == Date.ToString("MMM", culture) &&
                                              x.Anio == Date.ToString("yyyy", culture)).ToList().Sum(x => double.Parse(x.GastosCantidad)).ToString();
                CollectionGastos = new ObservableCollection <Gastos>(ListaGastos.OrderByDescending(x => double.Parse(x.Dia)).ToList());
                instanciarPaginasService.Instanciar();
            }
            else
            {
                return;
            }
        }