protected override async Task ActionAsync() { var siteId = Input.Data.Site.SiteId; await UserSecurity.CheckAdministratorAsync(_userService, Input.UserId, siteId); var itemDataModel = await _dataFactory.ItemRepository.GetItemAsync(siteId, Input.Data.ModuleId, false, true); var addSiteBusinessModel = (AddSiteBusinessModel)itemDataModel.Data; addSiteBusinessModel.Templates = Input.Data.Templates; addSiteBusinessModel.UrlConditionsGeneralesUtilisations = Input.Data.UrlConditionsGeneralesUtilisations; var elements = await SaveFreeCommand.GetElementsAsync(_dataFactory, itemDataModel, Input.Data.Elements); // On enregistre l'element addSiteBusinessModel.Elements = elements; await _dataFactory.SaveChangeAsync(); await _cacheProvider.UpdateCacheAsync(siteId); Result.Data = new ExpandoObject(); Result.Data.Master = await _moduleManager.GetMasterAsync(Input.Data.Site); }
protected override async Task ActionAsync() { var _siteId = Input.Data.SiteId; await UserSecurity.CheckAdministratorAsync(_userService, Input.UserId, _siteId); // var notificationDb = await GetAsync<NotificationBusinessModel>(_siteId, _siteId, NotificationBusinessModule.ModuleName, "Notification"); var notificationItemDb = await SaveFreeCommand.SaveItemDataModelAsync <NotificationItemBusinessModel>(_dataFactory, Input.Data.Data, Input.UserId, NotificationItemBusinessModule.ModuleName); var elements = await SaveFreeCommand.GetElementsAsync(_dataFactory, notificationItemDb, Input.Data.Data.Elements); // On enregistre l'element var freeBusinessModel = (NotificationItemBusinessModel)notificationItemDb.Data; freeBusinessModel.Elements = elements; await _dataFactory.SaveChangeAsync(); var siteInfo = await SiteMap.SiteUrlAsync(_routeManager, _dataFactory, _siteId); var userDb = await _userService.FindApplicationUserByIdAsync(Input.UserId); foreach (var siteUserId in Input.Data.SiteUserIds) { var siteUserDb = await _siteUserService.FindAsync(siteUserId); await SendEmailAsync(siteInfo, _emailService, siteUserDb, userDb, elements, _siteId); } }
protected override async Task ActionAsync() { await UserSecurity.CheckAdministratorAsync(_userService, Input.UserId, Input.Data.Site.SiteId); var itemDataModel = await GetMasterItemDataModelAsync(_dataFactory, Input.Data.Site.SiteId, true); if (itemDataModel == null) { itemDataModel = new ItemDataModel(); itemDataModel.SiteId = Input.Data.Site.SiteId; itemDataModel.ParentId = Input.Data.Site.SiteId; itemDataModel.PropertyName = "Master"; itemDataModel.Module = "Master"; itemDataModel.Index = 100; // TODO _dataFactory.Add(itemDataModel); } var elements = await SaveFreeCommand.GetElementsAsync(_dataFactory, itemDataModel, Input.Data.Elements); // On enregistre l'element var freeBusinessModel = new MasterBusinessModel(); freeBusinessModel.Elements = elements; itemDataModel.Data = freeBusinessModel; await _dataFactory.SaveChangeAsync(); await _cacheProvider.UpdateCacheAsync(Input.Data.Site.SiteId); Result.Data = await _moduleManager.GetMasterAsync(Input.Data.Site); }