public async Task <IActionResult> GetObjective(int userId, string deptName, string objectiveName)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var objectiveFromRepo = await _repo.GetObjective(userId, deptName, objectiveName);

            ObjectiveForCreationDto objectiveForReturn = _mapper.Map <ObjectiveForCreationDto>(objectiveFromRepo);

            return(Ok(objectiveForReturn));
        }
        public async Task <IActionResult> AddObjective(int userId, ObjectiveForCreationDto objectiveForCreation)
        {
            var creator = await _userRepo.GetUser(userId);

            if (creator.Id != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var objective = _mapper.Map <Objective>(objectiveForCreation);

            objective.User = creator;

            _repo.Add(objective);

            if (await _repo.SaveAll())
            {
                var jobToReturn = _mapper.Map <ObjectiveForCreationDto>(objective);
                return(CreatedAtRoute("GetObjective", new { objectiveName = objective.ObjectiveName, deptName = objective.deptName, userId = userId }, jobToReturn));
            }

            throw new Exception("Creation of Objective failed on save");
        }