public virtual async Task CreateAsync(OrganizationUnit organizationUnit) { organizationUnit.Code = await GetNextChildCodeAsync(organizationUnit.ParentId); await ValidateOrganizationUnitAsync(organizationUnit); await OrganizationUnitRepository.InsertAsync(organizationUnit); }
public virtual async Task CreateAsync(OrganizationUnit organizationUnit) { using (var uow = UnitOfWorkManager.Begin()) { organizationUnit.Code = await GetNextChildCodeAsync(organizationUnit.ParentId); await ValidateOrganizationUnitAsync(organizationUnit); await OrganizationUnitRepository.InsertAsync(organizationUnit); await uow.CompleteAsync(); } }