Ejemplo n.º 1
0
        public async Task <IActionResult> ChangePrevent(int tId, bool open)
        {
            try
            {
                int success = await _teamManager.CloseTeam(tId, open);

                return(Json(new ApiResponse
                {
                    Success = success == 0,
                    DisplayMessage =
                        success == 0
                            ? open ? "Members can join this team." : "Team is closed now."
                            : "Something happened, try again.",
                    ErrorCode = success
                }));
            }
            catch (Exception e)
            {
                return(new BadRequestObjectResult("An error occurred during processing your request. Try again."));
            }
        }