Exemplo n.º 1
0
 public IEnumerable <Transaction>?DashboardTransactions(
     [Service] IContextProvider contextProvider,
     int month,
     int year)
 {
     return(contextProvider.GetService <ITransactionService>().GetDashboardTransactions(month, year));
 }
Exemplo n.º 2
0
 public Task <UserNotification> ToggleReadNotification(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] int id,
     [GraphQLNonNullType] bool read)
 {
     return(contextProvider.GetService <IUserNotificationService>().ToggleRead(id, read));
 }
Exemplo n.º 3
0
 public IEnumerable <Transaction>?TransactionsByMonth(
     [Service] IContextProvider contextProvider,
     int month,
     int year)
 {
     return(contextProvider.GetService <ITransactionService>().GetTransactionsByMonth(month, year));
 }
Exemplo n.º 4
0
 public IEnumerable <RegularTransaction>?RecurringTransactionsByMonth(
     [Service] IContextProvider contextProvider,
     int month,
     int year)
 {
     return(contextProvider.GetService <IRecurringTransactionService>()
            .GetRegularTransactionsByMonth(month, year));
 }
 public Task <IEnumerable <UserSetting>?> UpdateUserSettings(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] IEnumerable <UpdateUserSettingInput> settings)
 {
     return(contextProvider.GetService <IUserSettingService>().Update(settings.Select(setting => new UserSetting
     {
         Name = setting.Name,
         Value = setting.Value
     }).ToList()));
 }
 public Task <UserSetting> UpdateUserSetting(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] UpdateUserSettingInput setting)
 {
     return(contextProvider.GetService <IUserSettingService>().Update(new UserSetting
     {
         Name = setting.Name,
         Value = setting.Value
     }));
 }
 public Task <IEnumerable <CurrencyExchangeRate> >?ExchangeRates(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] string sourceCurrencyAbbreviation,
     [GraphQLNonNullType] string targetCurrencyAbbreviation
     )
 {
     return(contextProvider.GetService <ICurrencyExchangeRateService>().GetBySourceAndTarget(
                sourceCurrencyAbbreviation,
                targetCurrencyAbbreviation
                ));
 }
Exemplo n.º 8
0
 public Task <Category> UpdateCategory(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] UpdateCategoryInput category)
 {
     return(contextProvider.GetService <ICategoryService>().Update(new Category
     {
         Id = category.Id,
         Name = category.Name,
         IconUrl = category.IconUrl
     }));
 }
 public Task <Wallet> UpdateWallet(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] UpdateWalletInput wallet)
 {
     return(contextProvider.GetService <IWalletService>().Update(new Wallet
     {
         Id = wallet.Id,
         Name = wallet.Name,
         Balance = wallet.Balance ?? default,
         CurrencyAbbreviation = wallet.CurrencyAbbreviation,
         IsDefault = wallet.IsDefault
     }, wallet.ConvertBalance, wallet.ExchangeRate));
Exemplo n.º 10
0
 public Task <UserNotification> CreateNotification(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] NewNotificationInput notification)
 {
     return(contextProvider.GetService <IUserNotificationService>().Create(new UserNotification
     {
         Title = notification.Title,
         Content = notification.Content,
         IsRead = false,
         User = contextProvider.GetRepository <IUserRepository>().GetByKey(notification.UserId)
     }));
 }
Exemplo n.º 11
0
 public Task <Category> CreateCategory(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] NewCategoryInput category)
 {
     return(contextProvider.GetService <ICategoryService>().Create(new Category
     {
         Name = category.Name,
         TypeName = category.TransactionTypeName,
         IconUrl = category.IconUrl,
         IsCustom = true
     }));
 }
Exemplo n.º 12
0
 public Task <Transaction> CreateTransaction(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] NewTransactionInput transaction)
 {
     return(contextProvider.GetService <ITransactionService>().Create(new Transaction
     {
         Title = transaction.Title,
         CategoryId = transaction.CategoryId,
         Amount = transaction.Amount,
         Date = transaction.Date ?? DateTime.Today,
         WalletId = transaction.WalletId ?? default
     }));
 public Task <Wallet> CreateWallet(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] NewWalletInput wallet)
 {
     return(contextProvider.GetService <IWalletService>().Create(new Wallet
     {
         Name = wallet.Name,
         Balance = wallet.Balance,
         CurrencyAbbreviation = wallet.CurrencyAbbreviation,
         IsDefault = wallet.IsDefault
     }));
 }
 public Task <CurrencyExchangeRate> UpdateExchangeRate(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] UpdateExchangeRateInput exchangeRate)
 {
     return(contextProvider.GetService <ICurrencyExchangeRateService>().Update(new CurrencyExchangeRate
     {
         Id = exchangeRate.Id,
         SourceCurrencyAbbreviation = exchangeRate.SourceCurrencyAbbreviation,
         TargetCurrencyAbbreviation = exchangeRate.TargetCurrencyAbbreviation,
         ExchangeRate = exchangeRate.ExchangeRate ?? default,
         ValidFrom = exchangeRate.ValidFrom ?? default,
         ValidTo = exchangeRate.ValidTo ?? default
     }));
 public Task <BugReport> ReportBug(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] NewBugReportInput bugReport)
 {
     return(contextProvider.GetService <ISalesforceService>().CreateCase(new BugReport
     {
         Name = bugReport.Name,
         Email = bugReport.Email,
         Phone = bugReport.Phone,
         Subject = bugReport.Subject,
         Description = bugReport.Description
     }));
 }
Exemplo n.º 16
0
        public IEnumerable <TransactionDelta>?TransactionsDelta([Service] IContextProvider contextProvider, int year, bool isRecurring = false)
        {
            if (year == default)
            {
                year = DateTime.Today.Year;
            }

            IEnumerable <TransactionDelta> transactionsDelta;

            if (isRecurring)
            {
                transactionsDelta = contextProvider.GetService <IRecurringTransactionService>()
                                    .GetRegularTransactionsDelta(year);
            }
            else
            {
                transactionsDelta = contextProvider.GetService <ITransactionService>()
                                    .GetTransactionsDelta(year);
            }

            return(transactionsDelta);
        }
Exemplo n.º 17
0
 public Task <RegularTransaction> CreateRegularTransaction(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] NewRecurringTransactionInput transaction)
 {
     return(contextProvider.GetService <IRecurringTransactionService>().Create(new RegularTransaction
     {
         Title = transaction.Title,
         CategoryId = transaction.CategoryId,
         Amount = transaction.Amount,
         Date = DateTime.Today,
         NextTransactionDate = transaction.NextTransactionDate,
         Interval = transaction.Interval,
         WalletId = transaction.WalletId ?? default
     }));
 public Task <CurrencyExchangeRate> CreateExchangeRate(
     [Service] IContextProvider contextProvider,
     [GraphQLNonNullType] NewExchangeRateInput exchangeRate)
 {
     return(contextProvider.GetService <ICurrencyExchangeRateService>().Create(new CurrencyExchangeRate
     {
         SourceCurrencyAbbreviation = exchangeRate.SourceCurrencyAbbreviation,
         TargetCurrencyAbbreviation = exchangeRate.TargetCurrencyAbbreviation,
         ExchangeRate = exchangeRate.ExchangeRate,
         ValidFrom = exchangeRate.ValidFrom,
         ValidTo = exchangeRate.ValidTo,
         IsCustom = true
     }));
 }
 public IEnumerable <Language>?Languages([Service] IContextProvider contextProvider)
 {
     return(contextProvider.GetService <IUserSettingService>().GetLanguages());
 }
 public IEnumerable <TransactionType> TransactionTypes([Service] IContextProvider contextProvider)
 {
     return(contextProvider.GetService <ITransactionTypeService>().GetAll());
 }
Exemplo n.º 21
0
 public Task <Category> DeleteCategory([Service] IContextProvider contextProvider, [GraphQLNonNullType] int id)
 {
     return(contextProvider.GetService <ICategoryService>().Delete(id));
 }
 public IEnumerable <Currency> Currencies([Service] IContextProvider contextProvider)
 {
     return(contextProvider.GetService <ICurrencyService>().GetAll());
 }
Exemplo n.º 23
0
 public User User([Service] IContextProvider contextProvider)
 {
     return(contextProvider.GetService <IUserService>().GetById());
 }
 public int UnreadNotificationsCount([Service] IContextProvider contextProvider)
 {
     return(contextProvider.GetService <IUserNotificationService>().GetUnreadCount());
 }
 public IEnumerable <UserNotification>?Notifications([Service] IContextProvider contextProvider)
 {
     return(contextProvider.GetService <IUserNotificationService>().GetAll());
 }
Exemplo n.º 26
0
 public IEnumerable <Category>?CustomCategories(
     [Service] IContextProvider contextProvider,
     string?transactionType)
 {
     return(contextProvider.GetService <ICategoryService>().GetCustomCategories(transactionType));
 }
Exemplo n.º 27
0
 public IEnumerable <Wallet>?Wallets([Service] IContextProvider contextProvider)
 {
     return(contextProvider.GetService <IWalletService>().GetAll());
 }
 public IEnumerable <UserSetting>?Settings([Service] IContextProvider contextProvider, string?unitName)
 {
     return(contextProvider.GetService <IUserSettingService>().GetByUnitName(unitName));
 }