Exemplo n.º 1
0
        public async Task <IActionResult> JoinInitiative(int id)
        {
            int userId = int.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier));

            if (await _initiativeService.UserExistsInInitiativeAsync(id, userId))
            {
                return(BadRequest(string.Format(_errorLocalizer["AlreadyInInitiative"].Value)));
            }
            await _initiativeService.JoinInitiativeAsync(id, userId);

            return(Ok());
        }