private async Task <LockDto> GenerateLockRowIfNotLocked(string companyId, long resourceId, string resourceCode, string resouceType, LockFunctionalContext lockFunctionalContext, string userName, string applicationSessionId) { var lockState = await _lockQueries.GetLockStateAsync(companyId, resourceId, applicationSessionId, resouceType); if (lockState.IsLocked) { throw new AtlasBusinessException(LockMessage.GenerateLockMessage(lockState)); } var lockRow = new LockDto() { ApplicationSessionId = applicationSessionId, CompanyId = companyId, FunctionalContext = lockFunctionalContext, LockAcquisitionDateTime = DateTime.UtcNow, LockOwner = userName, ResourceId = resourceId, ResourceCode = resourceCode != null ? resourceCode : ResourceCodeNotFound, ResourceType = resouceType }; return(lockRow); }
public async Task <ActionResult <LockStateResponseDto> > GetContractLockState(string company, long resourceId, string applicationSessionId) { var lockState = await _lockQueries.GetLockStateAsync(company, resourceId, applicationSessionId, ResourceType.Contract); return(Ok(lockState)); }