コード例 #1
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.Find(p => p.Name == "Scott").Any())
            {
                var data = new List <Patient>()
                {
                    new Patient
                    {
                        Name     = "Scott",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Medication1", Doses = 1
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Joy",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Medication2", Doses = 2
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Sarah",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Medication3", Doses = 3
                            }
                        }
                    }
                };
                patients.InsertMany(data);
            }
        }
コード例 #2
0
ファイル: MongoConfig.cs プロジェクト: tejal-gupta/ASPNet
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Scott"))
            {
            }
        }
コード例 #3
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Scott"))
            {
                var data = new List <Patient>()
                {
                    new Patient
                    {
                        Name     = "Scott",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "B6", Doses = 100
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Joy",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Complex B", Doses = 500
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Sarah",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Complex vitamin", Doses = 1000
                            }
                        }
                    }
                };

                patients.InsertBatch(data);
            }
        }
コード例 #4
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Chris"))
            {
                var data = new List <Patient>()
                {
                    new Patient {
                        Name     = "Chris",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Piracy"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Rum", Doses = 1
                            }
                        }
                    },
                    new Patient {
                        Name     = "Hailey",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Qwerty"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Aspirin", Doses = 200
                            }
                        }
                    },
                    new Patient {
                        Name     = "Chris",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Boring"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Cool", Doses = 3
                            }
                        }
                    },
                };

                patients.InsertBatch(data);
            }
        }
コード例 #5
0
ファイル: MongoConfig.cs プロジェクト: yoorw/PatientData
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Scott"))
            {
                var data = new List <Patient>()
                {
                    new Patient {
                        Name     = "Scott",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Funny"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Laughter", Doses = 2
                            }
                        }
                    },
                    new Patient {
                        Name     = "Ryan",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "GoofyPills", Doses = 1
                            }
                        }
                    },
                    new Patient {
                        Name     = "Chris",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Cranky"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "ChillPills", Doses = 3
                            }
                        }
                    }
                };

                patients.InsertMany(data);
            }
        }
コード例 #6
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Scott"))
            {
                var data = new List <Patient>
                {
                    new Patient {
                        Name = "Scott", Ailments = new List <Ailment> {
                            new Ailment {
                                Name = "Bald"
                            }
                        }, Medications = new List <Medication> {
                            new Medication {
                                Name = "Mioxil", Dosage = "100mg"
                            }
                        }
                    },
                    new Patient {
                        Name = "Mili", Ailments = new List <Ailment> {
                            new Ailment {
                                Name = "Crazy"
                            }
                        }, Medications = new List <Medication> {
                            new Medication {
                                Name = "Symbicort", Dosage = "100mg"
                            }
                        }
                    },
                    new Patient {
                        Name = "Baldie", Ailments = new List <Ailment> {
                            new Ailment {
                                Name = "Balding"
                            }
                        }, Medications = new List <Medication> {
                            new Medication {
                                Name = "Rogaine", Dosage = "100mg"
                            }
                        }
                    }
                };

                patients.InsertMany(data);
            }
        }
コード例 #7
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "dodo"))
            {
                var data = new List <Patient>()
                {
                    new Patient
                    {
                        Name     = "dodo",
                        Ailments = new List <Ailment> ()
                        {
                            new Ailment {
                                Name = "Crazyyyy"
                            }
                        },
                        Medications = new List <Medication>()
                    },
                    new Patient
                    {
                        Name     = "toto",
                        Ailments = new List <Ailment> ()
                        {
                            new Ailment {
                                Name = "Biiitch"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication {
                                Name = "Hard core", Doses = 100
                            }
                        }
                    }
                };

                patients.InsertMany(data);
            }
        }
コード例 #8
0
 public PatientController()
 {
     _patients = PatientDb.Open();
 }
コード例 #9
0
        internal static void SeedDatabase()
        {
            var db = PatientDb.Open();

            if (!db.AsQueryable().Any(p => p.Name == "Scott"))
            {
                var patients = new List <Patient>()
                {
                    new Patient {
                        Name     = "Scott",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }, new Ailment {
                                Name = "Old"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Aspirin", Dosage = 2
                            }
                        }
                    },
                    new Patient {
                        Name     = "Alex",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }, new Ailment {
                                Name = "Old"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Aspirin", Dosage = 2
                            }
                        }
                    },
                    new Patient {
                        Name     = "Chris",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment {
                                Name = "Crazy"
                            }, new Ailment {
                                Name = "Old"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Aspirin", Dosage = 2
                            }
                        }
                    }
                };

                db.InsertBatch(patients);
            }
        }
コード例 #10
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Scott"))
            {
                var data = new List <Patient>()
                {
                    new Patient
                    {
                        Name     = "Scott",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment()
                            {
                                Name = "Crazy Eyes"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication()
                            {
                                Name = "Aderall", Doses = 2
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Joy",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment()
                            {
                                Name = "Crazy Eyes"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication()
                            {
                                Name = "Aderall", Doses = 2
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Sarah",
                        Ailments = new List <Ailment>()
                        {
                            new Ailment()
                            {
                                Name = "Crazy Eyes"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication()
                            {
                                Name = "Aderall", Doses = 2
                            }
                        }
                    }
                };

                patients.InsertMany(data);
            }
        }
コード例 #11
0
        public static void Seed()
        {
            var patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Prajat"))
            {
                var data = new List <Patient>()
                {
                    new Patient()
                    {
                        Name = "Rajat", Ailments = new List <Ailment>()
                        {
                            new Ailment()
                            {
                                Name = "gastro"
                            }, new Ailment()
                            {
                                Name = "sex"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication()
                            {
                                Name = "juiefcjhb", Doses = 2
                            },
                            new Medication()
                            {
                                Name = "jfljslvjk", Doses = 3
                            }
                        }
                    },
                    new Patient()
                    {
                        Name = "Prajat", Ailments = new List <Ailment>()
                        {
                            new Ailment()
                            {
                                Name = "gastro"
                            }, new Ailment()
                            {
                                Name = "sex"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication()
                            {
                                Name = "juiefcjhb", Doses = 2
                            },
                            new Medication()
                            {
                                Name = "jfljslvjk", Doses = 3
                            }
                        }
                    },

                    new Patient()
                    {
                        Name = "efwfwf", Ailments = new List <Ailment>()
                        {
                            new Ailment()
                            {
                                Name = "gastro"
                            }, new Ailment()
                            {
                                Name = "sex"
                            }
                        },
                        Medications = new List <Medication>()
                        {
                            new Medication()
                            {
                                Name = "juiefcjhb", Doses = 2
                            },
                            new Medication()
                            {
                                Name = "jfljslvjk", Doses = 3
                            }
                        }
                    }
                };

                patients.InsertMany(data);
            }
        }
コード例 #12
0
 public PatientController()
 {
     _db = PatientDb.Open();
 }
コード例 #13
0
        public static void Seed()
        {
            MongoCollection <Patient> patients = PatientDb.Open();

            if (!patients.AsQueryable().Any(p => p.Name == "Scott"))
            {
                var data = new List <Patient>
                {
                    new Patient
                    {
                        Name     = "Scott",
                        Ailments = new List <Ailment> {
                            new Ailment {
                                Name = "Crazy"
                            }, new Ailment {
                                Name = "Old"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Aspirin", Doses = 2
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Joy",
                        Ailments = new List <Ailment> {
                            new Ailment {
                                Name = "Crazy"
                            }, new Ailment {
                                Name = "Young"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Aspirin", Doses = 2
                            }
                        }
                    },
                    new Patient
                    {
                        Name     = "Sarah",
                        Ailments = new List <Ailment> {
                            new Ailment {
                                Name = "Crazy"
                            }, new Ailment {
                                Name = "Youngest"
                            }
                        },
                        Medications = new List <Medication> {
                            new Medication {
                                Name = "Aspirin", Doses = 2
                            }
                        }
                    }
                };

                patients.InsertBatch(data);
            }
        }
コード例 #14
0
 public PatientsController()
 {
     Patients = PatientDb.Open();
 }
コード例 #15
0
 public PatientController()
 {
     ThePatientCollection = PatientDb.Open();
 }