示例#1
0
        public IActionResult CreateNewGoal(Goal goalToAdd)
        {
            var currentPointTotal = _pointsRepository.GetTotal(goalToAdd.UserId);

            if (goalToAdd.PointTarget >= currentPointTotal + 10)
            {
                var goal = _goalsRepository.AddNewGoal(goalToAdd);
                return(Created("successfully created a new goal", goal));
            }
            return(NotFound("Goal to Set is not at least 10 points above current total"));
        }
        public IActionResult GetPointTotal(int userId)
        {
            var pointTotal = _pointSystemRepository.GetTotal(userId);

            return(Ok(pointTotal));
        }