コード例 #1
0
        public static async Task Seed(AviTrackrDbContext context)
        {
            var exists = await context.MyTaskStatuses.AnyAsync();

            if (!exists)
            {
                context.MyTaskStatuses.Add(new MyTaskStatus
                {
                    StatusName        = "Not Started",
                    StatusDescription = "Have not started the Task"
                });
                context.MyTaskStatuses.Add(new MyTaskStatus
                {
                    StatusName        = "Pending",
                    StatusDescription = "Wait on something else"
                });
                context.MyTaskStatuses.Add(new MyTaskStatus
                {
                    StatusName        = "In Progress",
                    StatusDescription = "The task has started but not yet finished"
                });
                context.MyTaskStatuses.Add(new MyTaskStatus
                {
                    StatusName        = "Done",
                    StatusDescription = "The task is completed."
                });
                context.MyTaskStatuses.Add(new MyTaskStatus
                {
                    StatusName        = "Removed",
                    StatusDescription = "The task is no longer necessary."
                });
                await context.SaveChangesAsync();
            }
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: avington/avitrackr-server
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, AviTrackrDbContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseCors("dev");
            }

            Mapper.Initialize(i => i.AddProfiles(typeof(BaseEntity).GetTypeInfo().Assembly));

            UserProfileSeed.Seed(context).Wait();
            NotificationTypeSeed.Seed(context).Wait();
            MyTaskStatusesSeed.Seed(context).Wait();

            app.UseAuthentication();
            app.UseMvc();
        }
コード例 #3
0
        public static async Task Seed(AviTrackrDbContext context)
        {
            var exists = await context.NotificationTypes.AnyAsync();

            if (exists)
            {
                return;
            }
            context.NotificationTypes.Add(new NotificationType {
                NotificationTypeName = "Email"
            });
            context.NotificationTypes.Add(new NotificationType {
                NotificationTypeName = "SMS"
            });
            context.NotificationTypes.Add(new NotificationType {
                NotificationTypeName = "Alexa"
            });
            await context.SaveChangesAsync();
        }
コード例 #4
0
        public static async Task Seed(AviTrackrDbContext context)
        {
            bool exists = await context.UserProfiles.AnyAsync();

            if (exists == false)
            {
                context.UserProfiles.Add(new UserProfile()
                {
                    Email           = "*****@*****.**", FirstName = "Steven", LastName = "Moseley",
                    UserPermissions = new List <UserPermission>()
                    {
                        new UserPermission()
                        {
                            Value = "admin"
                        }
                    }
                });
                await context.SaveChangesAsync();
            }
        }
コード例 #5
0
 public Handler(AviTrackrDbContext context, IPagingResponseService pagingResponseService)
 {
     _context = context;
     _pagingResponseService = pagingResponseService;
 }
コード例 #6
0
 public Handler(AviTrackrDbContext context)
 {
     _context = context;
 }
コード例 #7
0
 public Handler(AviTrackrDbContext context, IMapperWrapper mapperWrapper)
 {
     this._context  = context;
     _mapperWrapper = mapperWrapper;
 }
コード例 #8
0
 public ValuesController(IMediator mediator, AviTrackrDbContext context)
 {
     _mediator = mediator;
     _context  = context;
 }