예제 #1
0
        public Gang AddGang([FromBody] Gang gang)
        {
            // TODO: validate request
            // TODO: Assign gang to principal
            var principal = User as ClaimsPrincipal;
            var userId    = principal.Claims.FirstOrDefault(claim => claim.Type == "userId");

            if (userId == null)
            {
                throw new HivemindException("User does not have a user ID");
            }

            var gangEntity = _gangManager.AddGang(gang);

            _gangManager.AssociateGangToUser(gang.GangId, userId.Value);

            return(gangEntity);
        }