Пример #1
0
        public void DeleteRole(Role role)
        {
            var rolePermissions = _db.RolePermissions
                                  .Where(p => p.RoleId == role.Id)
                                  .ToList();

            foreach (var permission in rolePermissions)
            {
                _db.SetEntityStateDeleted(permission);
            }

            _db.SetEntityStateDeleted(role);
            _db.SaveChanges();
        }
Пример #2
0
        public void DeleteModifierTemplate(ModifierTemplate modifierTemplate)
        {
            var positions = _db.ModifierTemplatePositions
                            .Where(t => t.ModifierTemplateId == modifierTemplate.Id)
                            .ToList();

            foreach (var position in positions)
            {
                _db.SetEntityStateDeleted(position);
            }

            _db.SetEntityStateDeleted(modifierTemplate);
            _db.SaveChanges();
        }
Пример #3
0
        public void DeleteInstrument(Instrument item)
        {
            var instrumentModStructures = _db.InstrumentModStructures
                                          .Where(structure => structure.InstrumentId == item.Id)
                                          .ToList();

            foreach (var modStructure in instrumentModStructures)
            {
                _db.SetEntityStateDeleted(modStructure);
            }

            _db.SetEntityStateDeleted(item);
            _db.SaveChanges();
        }
Пример #4
0
        public void DeleteModStructure(ModStructure modStructure)
        {
            foreach (var attachment in modStructure.ModStructureAttachments.ToList())
            {
                _db.SetEntityStateDeleted(attachment);
            }

            foreach (var instrumentModStructure in modStructure.InstrumentModStructures.ToList())
            {
                _db.SetEntityStateDeleted(instrumentModStructure);
            }

            _db.SetEntityStateDeleted(modStructure);
            _db.SaveChanges();
        }
Пример #5
0
 public void DeleteStrand(Strand strand)
 {
     strand.Species.Clear();
     _db.StrandModStructures.RemoveRange(_db.StrandModStructures.Where(m => m.StrandId == strand.Id));
     _db.SetEntityStateDeleted(strand);
     _db.SaveChanges();
 }
Пример #6
0
        public void Delete(MaterialRequest materialRequest)
        {
            var listDuplexes = materialRequest.RequestedDuplexes.ToList();

            foreach (var requestedDuplex in listDuplexes)
            {
                _db.SetEntityStateDeleted(requestedDuplex);
            }

            var listStrands = materialRequest.RequestedStrands.ToList();

            foreach (var requestedStrand in listStrands)
            {
                _db.SetEntityStateDeleted(requestedStrand);
            }

            _db.SetEntityStateDeleted(materialRequest);
            _db.SaveChanges();
        }
Пример #7
0
        public void DeleteDuplex(Duplex duplex)
        {
            _db.DuplexBatchStrandBatches.RemoveRange(duplex.Batches.SelectMany(ds => ds.DuplexBatchStrandBatches));
            _db.DuplexBatches.RemoveRange(duplex.Batches);

            var materialRequests = _db.DuplexMaterialRequests
                                   .Where(r => r.DuplexId == duplex.Id)
                                   .ToList();

            foreach (var request in materialRequests)
            {
                _db.SetEntityStateDeleted(request);
            }

            _db.Entry(duplex).State = EntityState.Deleted;
            _db.SaveChanges();
        }
Пример #8
0
 public void DeleteSpecies(Species item)
 {
     _db.SetEntityStateDeleted(item);
     _db.SaveChanges();
 }
Пример #9
0
 public void DeleteTarget(Target item)
 {
     _db.SetEntityStateDeleted(item);
     _db.SaveChanges();
 }