Example #1
0
        public bool AddAccount(AddWebsiteAccountDto dto)
        {
            if (!IsExits())
            {
                return(false);
            }

            if (!ValidateHelper.Validate(dto, out ValidateResults))
            {
                EwhStatus = core.Enums.GlobalStatus.InvalidData;
                return(false);
            }
            var account = _accountRepository.Get(dto.AccountId);

            if (account == null)
            {
                EwhStatus = core.Enums.GlobalStatus.Account_NotFound;
                return(false);
            }

            var coreDto = new core.Dtos.AddWebsiteAccountModel()
            {
                Account = account, Website = _website, AccessLevels = dto.AccessLevels, WebsiteDisplayName = _website.DisplayName
            };

            _websiteRepository.AddAccount(coreDto);
            _accountRepository.AddWebsite(coreDto);

            return(true);
        }