public override IWebDomain CreateWebDomain(string name, bool isVerified, IMailServerFactory factory) { if (factory == null) { throw new ArgumentNullException("factory"); } WebDomainDto domainDto; using (var dbContextWithTran = TeamlabDomainDal.CreateMailDbContext(true)) { domainDto = TeamlabDomainDal.AddWebDomain(name, isVerified, dbContextWithTran.DbManager); _CreateWebDomain(name); dbContextWithTran.CommitTransaction(); } var webdomain = factory.CreateWebDomain(domainDto.id, domainDto.tenant, domainDto.name, domainDto.is_virified, this); return(webdomain); }
public override void DeleteWebDomain(IWebDomain webDomain, IMailServerFactory factory) { if (webDomain == null) { throw new ArgumentNullException("webDomain", "ServerModel::DeleteWebDomain"); } if (factory == null) { throw new ArgumentNullException("factory", "ServerModel::DeleteWebDomain"); } using (var dbContextWithTran = TeamlabDomainDal.CreateMailDbContext(true)) { TeamlabDomainDal.DeleteDomain(webDomain.Id, dbContextWithTran.DbManager); _DeleteWebDomain(new WebDomainBase(webDomain)); TeamlabDnsDal.RemoveUsedDns(webDomain.Id, dbContextWithTran.DbManager); dbContextWithTran.CommitTransaction(); } }