public void SyncProperties(TripExpense expense)
		{
			this.Billable = expense.Billable;
			this.Category = expense.Category;
			this.Name = expense.Name;
			this.Price = expense.Price;
		}
 private void ExecuteUpdateExpense(TripExpense expense)
 {
   IsBusy = true;
   var index = Expenses.IndexOf(expense);
   Expenses[index] = expense;
   IsBusy = false;
 }
Beispiel #3
0
 public void SyncProperties(TripExpense expense)
 {
     this.Billable = expense.Billable;
     this.Category = expense.Category;
     this.Name     = expense.Name;
     this.Price    = expense.Price;
 }
		public async Task DeleteExpenseAsync(TripExpense expense)
		{
			if (!initialized)
				await Init();


			await expenseTable.DeleteAsync(expense);
		}
		public async Task<TripExpense> UpdateExpenseAsync(TripExpense expense)
    {
      if (!initialized)
        await Init();
      
      await expenseTable.UpdateAsync(expense);
			return expense;
    }
		public DetailsPage(TripExpense expense)
		{
			InitializeComponent();
			Type type = typeof(MultiTriggerConverter);
			foreach (var item in DetailViewModel.Categories)
				PickerCategory.Items.Add(item);

			ViewModel = new DetailViewModel(expense, Navigation);
		}
		public async Task<TripExpense> InsertExpenseAsync(TripExpense expense)
    {
      if (!initialized)
        await Init();

      
      await expenseTable.InsertAsync(expense);
			return expense;
    }
    public DetailViewModel(TripExpense expense, INavigation navigation)
    {
			dataStore = DependencyService.Get<IDataStore> ();
      this.navigation = navigation;
      if(expense == null)
      {
        isNew = true;
        expense = new TripExpense()
        {
          Name = string.Empty,
          Category = Categories[2],
          Price = string.Empty
        };
      }
      this.expense = expense;
      name = expense.Name;
      category = Categories.IndexOf(expense.Category);
      billable = expense.Billable;
      price = expense.Price;
    }
		private async Task ExecuteDeleteExpense(TripExpense expense)
		{
			IsBusy = true;
			await dataStore.DeleteExpenseAsync(expense);
			await dataStore.SyncExpensesAsync ();
			Expenses.Remove (expense);
			IsBusy = false;
		}