public async Task <SaveResponseDto> Insert(Domain.Assessment.Assessment entity) { var id = _assessmentRepository.GetLast().Id; entity.DataId = DataIdGenerationService.GenerateDataId(id, "AM"); var response = await _assessmentRepository.AddAsync(entity); return(new SaveResponseDto { SavedDataId = entity.DataId, SavedEntityId = entity.Id, SaveSuccessful = response != null }); }
public async Task <SaveResponseDto> Update(Domain.Assessment.Assessment entity) { if (entity.DataId == null) { var id = _assessmentRepository.GetLast().Id; entity.DataId = DataIdGenerationService.GenerateDataId(id, "AM"); } var response = await _assessmentRepository.UpdateAsync(entity, entity.Id); return(new SaveResponseDto { SavedDataId = entity.DataId, SavedEntityId = entity.Id, SaveSuccessful = response != null, ErrorMessage = response == null ? string.Empty : "update failed" }); }
public async Task <SaveResponseDto> Insert(AssetProperty entity) { var asset = new Domain.Asset.Asset { AssetTypeId = 1, AddedBy = 1, AddedDate = DateTime.UtcNow, IsArchived = false, IsDeleted = false, ManagingAgentId = 1, ManagingAgentPortfolioId = 2, SubPortfolioId = null, PortfolioId = null, }; var assetSavedResponse = await _assetRepository.AddAsync(asset); if (assetSavedResponse == null) { return new SaveResponseDto { SaveSuccessful = false, ErrorMessage = "Failed adding new property." } } ; entity.AssetId = asset.Id; var id = await _assetPropertyRepository.GetLast(); entity.DataId = DataIdGenerationService.GenerateDataId(id, "AR"); var propertySavedResponse = await _assetPropertyRepository.AddAsync(entity); return(new SaveResponseDto { SavedDataId = entity.DataId, SavedEntityId = entity.AssetId, RecordId = entity.Id, SaveSuccessful = propertySavedResponse != null, }); }
public async System.Threading.Tasks.Task AddTask(Domain.Task.Task task) { task.DataId = DataIdGenerationService.GenerateDataId(_taskRepository.GetLast().Id, "TA"); await _taskRepository.AddAsync(task); }