public async Task <long> AddProjectTreeNode(ProjectTreeNode projectTreeNode)
        {
            var ae = await _context.ProjectTree.AddAsync(projectTreeNode);

            await _context.SaveChangesAsync();

            return(ae.Entity.ProjectTreeNodeID);
        }
Exemple #2
0
        public async Task AddDataEventRecord(DataEventRecord dataEventRecord)
        {
            if (dataEventRecord.SourceInfo != null && dataEventRecord.SourceInfoId == 0)
            {
                _context.SourceInfos.Add(dataEventRecord.SourceInfo);
                _context.SaveChanges();
                dataEventRecord.SourceInfoId = dataEventRecord.SourceInfo.SourceInfoId;
            }
            else
            {
                var sourceInfo = _context.SourceInfos.Find(dataEventRecord.SourceInfo.SourceInfoId);
                sourceInfo.Description     = dataEventRecord.Description;
                sourceInfo.Name            = dataEventRecord.Name;
                dataEventRecord.SourceInfo = sourceInfo;
            }

            _context.DataEventRecords.Add(dataEventRecord);
            await _context.SaveChangesAsync();
        }