コード例 #1
0
        public async Task <int> AddSubscriberToUserGoal(int userId, int userGoalId)
        {
            int subscriberId = -1;

            bool exists = await _goalSubscriberRepository.Exists(userId, userGoalId);

            if (!exists)
            {
                subscriberId = await _goalSubscriberRepository.Create(new GoalSubscriber {
                    CompletedAmount      = 0,
                    MoneyAmountSaved     = 0,
                    SavingTransferAmount = 0,
                    SubscriberId         = userId,
                    UserGoalId           = userGoalId
                });
            }

            return(subscriberId);
        }