public static void EnsureSeedDataForContext(this StarsContext context)
        {
            if (context.Star.Any())
            {
                return;
            }

            var stars = new List <Star>
            {
                new Star()
                {
                    FirstName = "Arun",
                    LastName  = "Dsouza",
                    Email     = "*****@*****.**",
                    Mobile    = "0403698088",
                    Adults    = 4,
                    Children  = 2,
                    Infants   = 0,
                    Password  = GetBase64Password("Arun Dsouza"),
                    Addresses = new List <Address>()
                    {
                        new Address()
                        {
                            AddressLine1 = "Line 1",
                            AddressLine2 = "Line 2",
                            State        = "NSW",
                            Country      = "Australia",
                            Postcode     = "2145",
                        }
                    }
                }
            };

            context.Star.AddRange(stars);
            context.SaveChanges();
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory logger, StarsContext starsContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseCors(builder => builder
                        .AllowAnyHeader().AllowAnyOrigin().AllowAnyMethod());

            starsContext.EnsureSeedDataForContext();

            AutoMapper.Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <Star, StarDto>()
                .ForMember(x => x.Id, opt => opt.Ignore());
                cfg.CreateMap <StarDto, Star>();
                cfg.CreateMap <Address, AddressDto>()
                .ForMember(x => x.Id, opt => opt.Ignore());
                cfg.CreateMap <AddressDto, Address>()
                .ForMember(x => x.Star, opt => opt.Ignore());
            });

            app.UseStatusCodePages();

            app.UseMvc();

            app.Run(async(context) =>
            {
                await context.Response.WriteAsync("Hello World!");
            });
        }
 public DummyController(StarsContext ctx)
 {
     _ctx = ctx;
 }
 public StarRepository(StarsContext starsContext)
 {
     _starContext = starsContext;
 }
 public InvitationRepository(StarsContext starsContext)
 {
     _starContext = starsContext;
 }