public IHttpActionResult CreateWebsiteAndConfirm(CreateWebsiteDto dto)
 {
     if (ModelState.IsValid)
     {
         if (_websiteManager.CreateWebsiteAndConfirm(dto))
         {
             return(Ok(new WebsiteInfoDto(_websiteManager.EwhWebsiteAdded)));
         }
         return(ServerError(_websiteManager as EwhEntityBase));
     }
     return(BadRequest());
 }
Exemplo n.º 2
0
        public bool CreateWebsite(CreateWebsiteDto dto)
        {
            var ewhWebsite = new EwhWebsite(_websiteRepository, _accountRepository, _ewhMapper, _entityFactory);

            ewhMapper.ToEntity(ewhWebsite, dto);
            ewhWebsite.WebsiteType = WebsiteTypes.Free.ToString();
            var check = false;

            // create website
            if (ewhWebsite.Create())
            {
                check = true;
                ewhWebsite.InitGogSource();
                EwhWebsiteAdded = ewhWebsite;
            }
            SyncStatus(this, ewhWebsite);
            return(check);
        }
Exemplo n.º 3
0
        public EwhWebsite ToEntity(EwhWebsite ewhWebsite, CreateWebsiteDto dto)
        {
            ewhWebsite.DisplayName   = dto.DisplayName;
            ewhWebsite.Url           = dto.Url;
            ewhWebsite.Name          = dto.Name;
            ewhWebsite.WebTemplateId = dto.WebTemplateId;

            var listWebsiteAccountAccessLevel = new List <AccountsAccessLevelOfWebsite>();

            if (dto.Accounts != null)
            {
                foreach (var item in dto.Accounts)
                {
                    var waal = this.ToEntity(new AccountsAccessLevelOfWebsite(), item);
                    listWebsiteAccountAccessLevel.Add(waal);
                }
            }
            ewhWebsite.Accounts = listWebsiteAccountAccessLevel;
            return(ewhWebsite);
        }