public async Task <IHttpActionResult> AddCustomSecureControlPanel(CustomSecureControlPanelModel model) { var CompanyEntity = await _customSecureControlPanelService.CreateCustommeSecureControlPanel(model); var UpdateCompany = new UpdateCompanyViewModel() { Id = CompanyEntity.Id, ParentId = CompanyEntity.ParentId, Name = CompanyEntity.Name, Website = CompanyEntity.Website, LogoBase64 = CompanyEntity.LogoUrl, SupportSiteUrl = CompanyEntity.SupportSiteUrl, ControlPanelSiteUrl = CompanyEntity.ControlPanelSiteUrl, Email = CompanyEntity.Email, PhoneNumber = CompanyEntity.PhoneNumber, StreetAddress = CompanyEntity.StreetAddress, City = CompanyEntity.City, ZipCode = CompanyEntity.ZipCode, State = CompanyEntity.State, Country = CompanyEntity.Country, BrandColorPrimary = CompanyEntity.BrandColorPrimary, BrandColorSecondary = CompanyEntity.BrandColorSecondary, BrandColorText = CompanyEntity.BrandColorText, Domains = CompanyEntity.Domains.AsEnumerable().Select(x => new CreateDomainViewModel { Name = x.Name, IsPrimary = x.IsPrimary }).ToList() }; var updateCompanyQueue = CompanyServiceConstants.QueueUpdateCompany; await _messageBroker.GetSendEndpoint(updateCompanyQueue) .Send <IUpdateCompanyCommand>( UpdateCompany.ToUpdateCompanyCommand() ); var sendEmailQueue = NotificationServiceConstants.QueueSendEmailNotification; await _messageBroker.GetSendEndpoint(sendEmailQueue).Send <ISendEmailCommand>( new { CustomSecureCompanyId = model.Id, CompanyId = model.Id, To = _cloudPlusApiSettings.CloudPlusSupportGroupEmail, EmailTemplateType = EmailTemplateType.CustomSecureControlPanelActivation, }); return(Ok()); }
public CustomSecureControlPanelModel GetCustomSecurePanel(int companyId) { var customSecureControlPanel = _dbContext.CustomSecureControlPanel.FirstOrDefault(p => p.CompanyID == companyId && p.IsDeleted == false); var CustomSecureControlPanel = new CustomSecureControlPanelModel() { Id = customSecureControlPanel.Id, CompanyName = customSecureControlPanel.CompanyName, CompanyAddressCity = customSecureControlPanel.CompanyAddressCity, CompanyAddressStreet = customSecureControlPanel.CompanyAddressStreet, CompanyAddressState = customSecureControlPanel.CompanyAddressState, CompanyAddressCountry = customSecureControlPanel.CompanyAddressCountry, CompanyAddressZipCode = customSecureControlPanel.CompanyAddressZipCode, ContactPerson = customSecureControlPanel.ContactPerson, ContactPhone = customSecureControlPanel.ContactPhone, CustomSecureControlPanelURL = customSecureControlPanel.CustomSecureControlPanelURL, }; return(CustomSecureControlPanel); }
public async Task <CloudPlus.Entities.Company> CreateCustommeSecureControlPanel(CustomSecureControlPanelModel model) { var IsComapanyExist = _dbContext.Companies.Where(x => x.Id == model.Id && x.IsDeleted == false).FirstOrDefault(); if (IsComapanyExist != null) { var IsControlPanelAlreadyExist = _dbContext.CustomSecureControlPanel.Where(x => x.CompanyID == model.Id && x.IsDeleted == false).FirstOrDefault(); { var ControlPanle = new CustomSecureControlPanel { CompanyID = model.Id, CompanyName = model.CompanyName, ContactPerson = model.ContactPerson, ContactPhone = model.ContactPhone, Email = model.Email, CustomSecureControlPanelURL = model.CustomSecureControlPanelURL, CompanyAddressStreet = model.CompanyAddressStreet, CompanyAddressCity = model.CompanyAddressCity, CompanyAddressState = model.CompanyAddressState, CompanyAddressCountry = model.CompanyAddressCountry, CompanyAddressZipCode = model.CompanyAddressZipCode, StatusId = 1 }; _dbContext.CustomSecureControlPanel.Add(ControlPanle); // var ModelComp = _dbContext.Companies.Where(x => x.Id == model.Id).FirstOrDefault(); if (IsComapanyExist.ControlPanelSiteUrl != null) { IsComapanyExist.ControlPanelSiteUrl = model.CustomSecureControlPanelURL; } else { throw new Exception("Error there is no resseller data not saved!"); } _dbContext.SaveChanges(); } } else { throw new Exception("Error there is no resseller in this company id!"); } return(IsComapanyExist); }