Exemplo n.º 1
0
            public static void Seed(PhysicianLookupDbContext context)
            {
                var json            = StaticFileLocator.GetAsString("physicians.json");
                var jArray          = JsonConvert.DeserializeObject <JObject>(json)["physicians"];
                var geometryFactory = NtsGeometryServices.Instance.CreateGeometryFactory(srid: 4326);

                foreach (var token in jArray)
                {
                    var physician = (JObject)token;

                    _ = context.Physicians.Add(new ()
                    {
                        Title     = (string)physician["title"],
                        Firstname = (string)physician["firstname"],
                        Lastname  = (string)physician["lastname"],
                        Address   = new Address(
                            (string)physician["street"],
                            (string)physician["city"],
                            (string)physician["province"],
                            (string)physician["postalCode"],
                            (double)physician["longitude"],
                            (double)physician["latitude"],
                            geometryFactory.CreatePoint(new Coordinate((double)physician["longitude"], (double)physician["latitude"]))),
                        EmailAddress = (string)physician["emailAddress"],
                        Website      = (string)physician["website"],
                    });
                }

                context.SaveChanges();
            }
Exemplo n.º 2
0
            public static void Seed(AppDbContext context)
            {
                if (context.HtmlContents.SingleOrDefault(x => x.Name == "TermsAndConditions.html") == null)
                {
                    context.HtmlContents.Add(new HtmlContent
                    {
                        Name  = "TermsAndConditions.html",
                        Value = StaticFileLocator.GetAsString("TermsAndConditions.html")
                    });
                }

                if (context.HtmlContents.SingleOrDefault(x => x.Name == "About.html") == null)
                {
                    context.HtmlContents.Add(new HtmlContent
                    {
                        Name  = "About.html",
                        Value = StaticFileLocator.GetAsString("About.html")
                    });
                }

                context.SaveChanges();
            }
Exemplo n.º 3
0
            public static void Seed(AppDbContext context)
            {
                if (context.EmailTemplates.SingleOrDefault(x => x.Name == nameof(EmailTemplateName.BookingConfirmation)) == null)
                {
                    context.EmailTemplates.Add(new EmailTemplate
                    {
                        Name  = nameof(EmailTemplateName.BookingConfirmation),
                        Value = StaticFileLocator.GetAsString("BookingConfirmationEmail.html")
                    });
                }

                if (context.EmailTemplates.SingleOrDefault(x => x.Name == nameof(EmailTemplateName.NewCustomer)) == null)
                {
                    context.EmailTemplates.Add(new EmailTemplate
                    {
                        Name  = nameof(EmailTemplateName.NewCustomer),
                        Value = StaticFileLocator.GetAsString("NewCustomerEmail.html")
                    });
                }

                context.SaveChanges();
            }