コード例 #1
0
ファイル: SeedData.cs プロジェクト: BigT1305/ArchPointPHR
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new ArchPointPHRContext(
                       serviceProvider.GetRequiredService <DbContextOptions <ArchPointPHRContext> >()))
            {
                //Look for any medication
                if (context.Medication.Any())
                {
                    return;     //DB has been seeded
                }

                context.Medication.AddRange(
                    new Medication
                {
                    Name      = "Lipitor",
                    Physician = "John Dee, MD",
                    Quantity  = 2,
                    Dosage    = "20mg",
                    Reason    = "",
                    Type      = "Cholesterol Medication"
                },

                    new Medication
                {
                    Name      = "Plavix",
                    Physician = "John Dee, MD",
                    Quantity  = 2,
                    Dosage    = "30mg",
                    Reason    = "",
                    Type      = "Heart and Stroke"
                },

                    new Medication
                {
                    Name      = "Celebrex",
                    Physician = "John Dee, MD",
                    Quantity  = 2,
                    Dosage    = "200mg",
                    Reason    = "",
                    Type      = "Arthritis"
                }
                    );
                context.SaveChanges();
            }
        }
コード例 #2
0
 public IndexModel(ArchPointPHR.Models.ArchPointPHRContext context)
 {
     _context = context;
 }
コード例 #3
0
 public CreateModel(ArchPointPHR.Models.ArchPointPHRContext context)
 {
     _context = context;
 }
コード例 #4
0
 public EditModel(ArchPointPHR.Models.ArchPointPHRContext context)
 {
     _context = context;
 }
コード例 #5
0
 public DetailsModel(ArchPointPHR.Models.ArchPointPHRContext context)
 {
     _context = context;
 }