public ClanCreateResult ClanCreate(ClanCreateRequest request)
        {
            int userId;

            this.TryGetUserId(out userId);

            Clan newClan = new Clan
            {
                Name        = request.Name,
                Tag         = request.Tag,
                Description = request.Description
            };

            _clanRepository.CreateAsync(newClan).Wait();
            var leaderMembership = new ClanMembership
            {
                ClanId = newClan.ClanId,
                UserId = userId,
                Role   = 1
            };

            _clanMembershipRepository.CreateAsync(leaderMembership).Wait();

            var leaderBaseData = _userBaseDataRepository.GetByUserIdAsync(userId).Result;

            return(new ClanCreateResult
            {
                Result = new ServiceResult <UserBaseData>
                {
                    Data = leaderBaseData
                }
            });
        }
Esempio n. 2
0
 public Task <Clan> CreateAsync(Clan clan)
 {
     clanRepository.CreateAsync(clan);
 }