예제 #1
0
        public async Task <int> Create(NormalizedLog model)
        {
            var dto = model.ToDomainModel();

            dto.CustomAttributeValues = new List <CustomAttributeValue>();

            var entity = await _db.NormalizedLog.AddAsync(dto);

            await _db.SaveChangesAsync();

            entity.State = EntityState.Detached;

            var valueDtos = new List <CustomAttributeValue>();

            foreach (var customAttributeValue in model.CustomAttributeValues)
            {
                var valueDto = customAttributeValue.ToDomainModel();
                valueDto.NormalizedLogId = entity.Entity.NormalizedLogId;
                valueDtos.Add(valueDto);
            }

            await _db.CustomAttributeValue.AddRangeAsync(valueDtos);

            await _db.SaveChangesAsync();

            return(entity.Entity.NormalizedLogId);
        }
예제 #2
0
        public async Task <bool> Update(NormalizedLog model)
        {
            var dto = model.ToDomainModel();

            _db.NormalizedLog.Update(dto);
            await _db.SaveChangesAsync();

            return(true);
        }