public bool AddOrUpdateStaging(DeploymentEnviromentModel dto) { var website = dto.Website; if (website.Stagging == null) { website.Stagging = new List <DeploymentEnvironment>(); } var websiteEnviroment = website.Stagging.FirstOrDefault(x => x.Id == dto.EnviromentId); if (websiteEnviroment != null) { website.Stagging.Remove(websiteEnviroment); } else { websiteEnviroment = new DeploymentEnvironment(); } if (string.IsNullOrEmpty(websiteEnviroment.Id)) { websiteEnviroment.Id = Guid.NewGuid().ToString(); } websiteEnviroment.Git = dto.Git; websiteEnviroment.Url = dto.Url; websiteEnviroment.HostingFee = dto.HostingFee; websiteEnviroment.Name = dto.Name; websiteEnviroment.IsDefault = dto.IsDefault; website.Stagging.Add(websiteEnviroment); this.AddOrUpdate(website); return(true); }
public DeploymentEnviromentModel ToEntity(DeploymentEnviromentModel model, UpdateDeploymentEnvironmentToWebsite dto) { model.Git = dto.Git; model.HostingFee = dto.HostingFee; model.IsDefault = dto.IsDefault; model.Name = dto.Name; model.Url = dto.Url; return(model); }
public bool RemoveProduction(string deId) { if (!IsExits()) { return(false); } var model = new DeploymentEnviromentModel() { Website = _website, EnviromentId = deId }; if (_websiteRepository.RemoveProduction(model)) { return(true); } return(false); }
public bool AddProduction(UpdateDeploymentEnvironmentToWebsite dto) { if (!IsExits()) { return(false); } var model = new DeploymentEnviromentModel() { Website = _website }; if (_websiteRepository.AddOrUpdateProduction(ewhMapper.ToEntity(model, dto))) { return(true); } return(false); }
public bool RemoveStaging(DeploymentEnviromentModel dto) { var website = dto.Website; if (website.Stagging == null) { website.Stagging = new List <DeploymentEnvironment>(); } var websiteEnviroment = website.Stagging.FirstOrDefault(x => x.Id == dto.EnviromentId); if (websiteEnviroment != null) { website.Stagging.Remove(websiteEnviroment); this.AddOrUpdate(website); return(true); } return(false); }