Esempio n. 1
0
        /// <summary>
        /// Voir <see cref="IMedicamentRepository"/>
        /// </summary>
        /// <returns>Voir <see cref="IMedicamentRepository"/></returns>
        public void Add(Medicament medicament)
        {
            for (int i = 0; i < medicament.MedicamentExcipients.Count(); i++)
            {
                int eId = medicament.MedicamentExcipients.ToList()[i].ExcipientId;
                medicament.MedicamentExcipients.ToList()[i] = new MedicamentExcipient()
                {
                    Medicament = medicament,
                    Excipient  = _context.Excipient.Single(e => e.Id == eId)
                };
            }

            for (int i = 0; i < medicament.MedicamentPathologies.Count(); i++)
            {
                int pId = medicament.MedicamentPathologies.ToList()[i].PathologieId;
                medicament.MedicamentPathologies.ToList()[i] = new MedicamentPathologie()
                {
                    Medicament = medicament,
                    Pathologie = _context.Pathologie.Single(p => p.Id == pId)
                };
            }

            medicament.Famille = _context.Famille.Single(f => f.Id == medicament.Famille.Id);
            _context.Medicament.Add(medicament);
            _context.SaveChanges();
        }
Esempio n. 2
0
        /// <summary>
        /// Voir <see cref="IVisiteurRepository"/>
        /// </summary>
        /// <returns>Voir <see cref="IVisiteurRepository"/></returns>
        public void Update(Visiteur visiteur)
        {
            for (int i = 0; i < visiteur.Medecins.Count(); i++)
            {
                int idMed = visiteur.Medecins.ToList()[i].Id;
                visiteur.Medecins.ToList()[i] = _context.Medecin.Include(m => m.Ville).AsNoTracking().Single(m => m.Id == idMed);
            }

            _context.Visiteur.Update(visiteur);
            _context.SaveChanges();
        }
Esempio n. 3
0
 /// <summary>
 /// Voir <see cref="IMedecinRepository"/>
 /// </summary>
 /// <returns>Voir <see cref="IMedecinRepository"/></returns>
 public void Add(Medecin medecin)
 {
     //medecin.Ville = _context.Ville.Single(v => v.Id == medecin.Ville.Id);
     _context.Medecin.Add(medecin);
     _context.SaveChanges();
 }
Esempio n. 4
0
 /// <summary>
 /// Voir <see cref="IFamilleRepository"/>
 /// </summary>
 /// <returns>Voir <see cref="IFamilleRepository"/></returns>
 public void Add(Famille famille)
 {
     _context.Famille.Add(famille);
     _context.SaveChanges();
 }
Esempio n. 5
0
 /// <summary>
 /// Voir <see cref="IMedicamentExcipientRepository"/>
 /// </summary>
 /// <returns>Voir <see cref="IMedicamentExcipientRepository"/></returns>
 public void Add(MedicamentExcipient medicamentExcipient)
 {
     _context.MedicamentExcipient.Add(medicamentExcipient);
     _context.SaveChanges();
 }
Esempio n. 6
0
 /// <summary>
 /// Voir <see cref="IMedicamentPathologieRepository"/>
 /// </summary>
 /// <returns>Voir <see cref="IMedicamentPathologieRepository"/></returns>
 public void Add(MedicamentPathologie medicamentPathologie)
 {
     _context.MedicamentPathologie.Add(medicamentPathologie);
     _context.SaveChanges();
 }