protected override async Task SaveCategory() { if (string.IsNullOrEmpty(SelectedCategory.Name)) { await dialogService.ShowMessage(Strings.MandatoryFieldEmptyTitle, Strings.NameRequiredMessage); return; } if (await crudServices.ReadManyNoTracked <CategoryViewModel>().AnyWithNameAsync(SelectedCategory.Name)) { await dialogService.ShowMessage(Strings.DuplicatedNameTitle, Strings.DuplicateCategoryMessage); return; } await crudServices.CreateAndSaveAsync(SelectedCategory, "ctor(2)"); if (!crudServices.IsValid) { await dialogService.ShowMessage(Strings.GeneralErrorTitle, crudServices.GetAllErrors()); } NavigationService.GoBack(); }
protected override async Task SaveCategory() { if (string.IsNullOrEmpty(SelectedCategory.Name)) { await dialogService.ShowMessage(Strings.MandatoryFieldEmptyTitle, Strings.NameRequiredMessage); return; } if (await mediator.Send(new GetIfCategoryWithNameExistsQuery { CategoryName = SelectedCategory.Name })) { await dialogService.ShowMessage(Strings.DuplicatedNameTitle, Strings.DuplicateCategoryMessage); return; } // TODO: Reimplement //await crudServices.CreateAndSaveAsync(SelectedCategory, "ctor(2)"); //if (!crudServices.IsValid) //{ // await dialogService.ShowMessage(Strings.GeneralErrorTitle, crudServices.GetAllErrors()); //} NavigationService.GoBack(); }
protected override async Task SavePayment() { try { var payment = new Payment(SelectedPayment.Date, SelectedPayment.Amount, SelectedPayment.Type, mapper.Map <Account>(SelectedPayment.ChargedAccount), mapper.Map <Account>(SelectedPayment.TargetAccount), mapper.Map <Category>(SelectedPayment.Category), SelectedPayment.Note); if (SelectedPayment.IsRecurring) { payment.AddRecurringPayment(SelectedPayment.RecurringPayment.Recurrence, SelectedPayment.RecurringPayment.EndDate); } await mediator.Send(new CreatePaymentCommand(payment)); navigationService.GoBack(); } catch (InvalidEndDateException) { await dialogService.ShowMessage(Strings.InvalidEnddateTitle, Strings.InvalidEnddateMessage); } catch (Exception ex) { logger.Error(ex); throw; } }
protected override async Task SaveAccount() { if (await crudService.ReadManyNoTracked <AccountViewModel>() .AnyWithNameAsync(SelectedAccount.Name)) { await dialogService.ShowMessage(Strings.MandatoryFieldEmptyTitle, Strings.NameRequiredMessage); return; } await crudService.CreateAndSaveAsync(SelectedAccount, "ctor(4)"); if (!crudService.IsValid) { await dialogService.ShowMessage(Strings.GeneralErrorTitle, crudService.GetAllErrors()); } NavigationService.GoBack(); }
protected override async Task SaveAccount() { await crudServices.UpdateAndSaveAsync(SelectedAccount); if (!crudServices.IsValid) { await dialogService.ShowMessage(Strings.GeneralErrorTitle, crudServices.GetAllErrors()); } CancelCommand.Execute(null); }
protected override async Task SaveCategory() { if (string.IsNullOrEmpty(SelectedCategory.Name)) { await dialogService.ShowMessage(Strings.MandatoryFieldEmptyTitle, Strings.NameRequiredMessage); return; } if (await mediator.Send(new GetIfCategoryWithNameExistsQuery { CategoryName = SelectedCategory.Name })) { await dialogService.ShowMessage(Strings.DuplicatedNameTitle, Strings.DuplicateCategoryMessage); return; } NavigationService.GoBack(); }
protected override async Task SavePayment() { try { await paymentService.UpdatePayment(SelectedPayment); navigationService.GoBack(); } catch (InvalidEndDateException) { await dialogService.ShowMessage(Strings.InvalidEnddateTitle, Strings.InvalidEnddateMessage); } }
protected override async Task SaveAccount() { if (await mediator.Send(new GetIfAccountWithNameExistsQuery { AccountName = SelectedAccount.Name })) { await dialogService.ShowMessage(Strings.MandatoryFieldEmptyTitle, Strings.NameRequiredMessage); return; } await mediator.Send(new CreateAccountCommand { AccountToSave = mapper.Map <Account>(SelectedAccount) }); NavigationService.GoBack(); }