Beispiel #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);
        }
Beispiel #2
0
        public WebsiteIdentity ToEntity(WebsiteIdentity entity, AddWebsiteAccountDto dto)
        {
            //entity.DisplayName = dto.WebsiteDisplayName;
            //entity.WebsiteId = dto.WebsiteId;

            return(entity);
        }
Beispiel #3
0
 public bool Create()
 {
     if (!Save())
     {
         return(false);
     }
     WebsiteId = _website.Id;
     if (_website.Accounts != null && _website.Accounts.Any())
     {
         var accList = new AccountsAccessLevelOfWebsite[_website.Accounts.Count];
         _website.Accounts.CopyTo(accList);
         foreach (var acc in accList)
         {
             var addWebsiteAccount = new AddWebsiteAccountDto()
             {
                 AccessLevels = acc.AccessLevels, AccountId = acc.AccountId
             };
             this.AddAccount(addWebsiteAccount);
         }
     }
     return(true);
 }
Beispiel #4
0
        public AccountsAccessLevelOfWebsite ToEntity(AccountsAccessLevelOfWebsite entity, AddWebsiteAccountDto dto)
        {
            entity.AccountId    = dto.AccountId;
            entity.AccessLevels = dto.AccessLevels;

            return(entity);
        }