Example #1
0
        public void CreateStrandBatch(StrandBatch strandBatch)
        {
            var strandId = strandBatch.StrandId;
            var strand   = _db.Strands.Find(strandId);

            if (strand != null && !IsStrandBatchExist(strandBatch))
            {
                strand.Batches.Add(strandBatch);
                _db.SetEntityStateAdded(strandBatch);
                _db.SetEntityStateModified(strand);
                _db.SaveChanges();
            }
        }
Example #2
0
 public void CreateSpecies(Species item)
 {
     if (!IsSpeciesExists(item))
     {
         _db.SetEntityStateAdded(item);
         _db.SaveChanges();
     }
 }
Example #3
0
 public void CreateInstrument(Instrument item)
 {
     if (!IsInstrumentExists(item))
     {
         _db.SetEntityStateAdded(item);
         _db.SaveChanges();
     }
 }
Example #4
0
 public void CreateTarget(Target item)
 {
     if (!IsTargetExists(item))
     {
         _db.SetEntityStateAdded(item);
         _db.SaveChanges();
     }
 }
Example #5
0
 public void CreateModStructure(ModStructure item)
 {
     if (!IsModStructureExists(item))
     {
         item.ModStructureType        = null;
         item.ModStructureAttachments = null;
         _db.SetEntityStateAdded(item);
         _db.SaveChanges();
     }
 }
Example #6
0
        public void Create(MaterialRequest materialRequest)
        {
            var status = _db.Status.FirstOrDefault(s => s.Description.Equals("Submitted"));

            if (status != null)
            {
                materialRequest.StatusId    = status.Id;
                materialRequest.RequestDate = DateTime.Now;
                _db.SetEntityStateAdded(materialRequest);
                _db.SaveChanges();
            }
        }
Example #7
0
        public void CreateSynthesisRequest(SynthesisRequest synthesisRequest)
        {
            RequestStatus status = _db.Status.FirstOrDefault(s => s.Description.Equals("Submitted"));
            if (status != null)
            {
                synthesisRequest.StatusId = status.Id;
                synthesisRequest.RequestDate = DateTime.Now;

                //insert MaterialRequest
                var materialRequests = synthesisRequest.MaterialRequests.ToList();
                synthesisRequest.MaterialRequests.Clear();
                foreach (var request in materialRequests)
                {
                    var materialRequest = _db.MaterialRequests.FirstOrDefault(d => d.Id == request.Id);
                    synthesisRequest.MaterialRequests.Add(materialRequest);
                }

                _db.SetEntityStateAdded(synthesisRequest);
                _db.SaveChanges();
            }
        }
Example #8
0
 public void CreateRole(Role role)
 {
     _db.SetEntityStateAdded(role);
     _db.SaveChanges();
 }
Example #9
0
 public void CreateModifierTemplate(ModifierTemplate modifierTemplate)
 {
     modifierTemplate.Orientation = null;
     _db.SetEntityStateAdded(modifierTemplate);
     _db.SaveChanges();
 }