Пример #1
0
        public async Task <long> GetNewImportNumber(GetImportNumberRequest request)
        {
            var newImportNumber = new ImportNumber
            {
                Comment  = request.Comment,
                Priority = request.Priority,
                Type     = (LabelingType)request.Type
            };

            await importRepository.AddAsync(newImportNumber);

            if (request.AssignedLabels == null)
            {
                return(newImportNumber.Id);
            }

            var assignedImports = request.AssignedLabels.Select(item => new AssignedLabelGroups
            {
                ImportNumber = newImportNumber.Id,
                LabelGroupId = item
            }).ToArray();

            await assignedLabelGroupsRepository.AddRangeAsync(assignedImports);

            return(newImportNumber.Id);
        }
Пример #2
0
        public Task UpdateAsync(ImportNumber import)
        {
            importNumberDataSet.Update(import);

            return(dbContext.SaveChangesAsync());
        }
Пример #3
0
        public Task AddAsync(ImportNumber newImport)
        {
            importNumberDataSet.Add(newImport);

            return(dbContext.SaveChangesAsync());
        }