Пример #1
0
        public async Task <IActionResult> DeleteGoalAsync(Guid id)
        {
            if (!Guid.TryParse(HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value, out Guid userId))
            {
                return(Unauthorized());
            }

            var deleteGoalCommand = new DeleteGoalCommand()
            {
                Id = id
            };
            var hasBeenDeleted = await _mediator.Send(deleteGoalCommand);

            return(NoContent());
        }
Пример #2
0
 public GoalsController(AllGoalsQuery allGoalsQuery,
                        UserGoalsQuery userGoalsQuery,
                        GoalQuery goalQuery,
                        CreateGoalCommand createGoalCommand,
                        UpdateGoalCommand updateGoalCommand,
                        DeleteGoalCommand deleteGoalCommand,
                        CompleteGoalCommand completeGoalCommand)
 {
     this.allGoalsQuery       = allGoalsQuery;
     this.userGoalsQuery      = userGoalsQuery;
     this.goalQuery           = goalQuery;
     this.createGoalCommand   = createGoalCommand;
     this.updateGoalCommand   = updateGoalCommand;
     this.deleteGoalCommand   = deleteGoalCommand;
     this.completeGoalCommand = completeGoalCommand;
 }