Пример #1
0
        public async Task <ActionResult> InsertSiteDomain(string id, CorpSiteDomainViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (ValidateSiteIdInRouteAndModel(id, model.SiteId) == false)
                {
                    return(BadRequest(ModelState));
                }

                await _siteManager.AddSiteDomainAsync(model.SiteId, model.DomainKey, model.IsDefault);

                if (model.IsDefault)
                {
                    var site = await _siteManager.GetByIdAsync(id);

                    await _sitePublisher.QueueSearchIndex(site);
                }

                return(Ok(model));
            }
            return(BadRequest(ModelState));
        }