Ejemplo n.º 1
0
        public IActionResult Get(int count)
        {
            var userFromAuth = UserService.GetUserFromClaims(this.User, UserRepo, RequestLogger);

            RequestLogger.UserId = userFromAuth.Id.ToString();

            var budgets = BudgetRepo.FindCountByOwner(userFromAuth.Id, count);

            return(Ok(budgets));
        }
Ejemplo n.º 2
0
        public IActionResult Get()
        {
            var userFromAuth = UserService.GetUserFromClaims(this.User, UserRepo, RequestLogger);

            RequestLogger.UserId = userFromAuth.Id.ToString();

            var statusModel = new UserStatusModel()
            {
                IsEnabled    = userFromAuth.IsEnabled,
                AccountCount = AccountRepo.FindCountByOwner(userFromAuth.Id),
                BudgetCount  = BudgetRepo.FindCountByOwner(userFromAuth.Id),
            };

            if (statusModel.AccountCount == 0 || statusModel.BudgetCount == 0)
            {
                statusModel.IsNew = true;
            }
            return(Ok(statusModel));
        }
Ejemplo n.º 3
0
        private IActionResult GetStatusInternal(bool acknowledgeAccomplishments)
        {
            var userFromAuth = UserService.GetUserFromClaims(this.User, UserRepo, RequestLogger);

            RequestLogger.UserId = userFromAuth.Id.ToString();

            var statusModel = new UserStatusModel()
            {
                IsEnabled    = userFromAuth.IsEnabled,
                AccountCount = AccountRepo.FindCountByOwner(userFromAuth.Id),
                BudgetCount  = BudgetRepo.FindCountByOwner(userFromAuth.Id),
            };

            if (statusModel.AccountCount == 0 || statusModel.BudgetCount == 0)
            {
                statusModel.IsNew = true;
            }
            if (AccomplishmentService.GetAccomplishmentsAndSettings(statusModel, userFromAuth, acknowledgeAccomplishments))
            {
                UserRepo.UpsertFromEditableModelStates(userFromAuth, userFromAuth.UserName);
            }
            return(Ok(statusModel));
        }