예제 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, BlueDragonDbContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

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

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "blue-dragon v1");
            });

            // Create dummy data in the database
            ActivityD.ActivityDummyData(context);
        }
예제 #2
0
        public static void ActivityDummyData(BlueDragonDbContext db)
        {
            V1.Activity fromDb = db.Activities.Find(1);

            if (fromDb == null)
            {
                // Create Dummy data if db is empty
                Console.WriteLine("Add New Activity: ");
                db.Activities.Add(new V1.Activity {
                    DateTime = ConvertToDatetime("2020-09-08T16:34:23Z"), Description = "Bank Deposit", Amount = 500.00, Status = "Completed"
                });
                db.Activities.Add(new V1.Activity {
                    DateTime = ConvertToDatetime("2020-09-08T09:02:23Z"), Description = "Transfer to James", Amount = -20.00, Status = "Pending"
                });
                db.Activities.Add(new V1.Activity {
                    DateTime = ConvertToDatetime("2020-09-07T21:52:23Z"), Description = "ATM withdrawal", Amount = -20.00, Status = "Completed"
                });
                db.Activities.Add(new V1.Activity {
                    DateTime = ConvertToDatetime("2020-09-06T10:32:23Z"), Description = "Google Subscription", Amount = -15.00, Status = "Completed"
                });
                db.Activities.Add(new V1.Activity {
                    DateTime = ConvertToDatetime("2020-09-06T07:33:23Z"), Description = "Apple Store", Amount = -2000.00, Status = "Cancelled"
                });
                db.Activities.Add(new V1.Activity {
                    DateTime = ConvertToDatetime("2020-08-23T17:39:23Z"), Description = "Mini Mart", Amount = -23.76, Status = "Completed"
                });
                db.Activities.Add(new V1.Activity {
                    DateTime = ConvertToDatetime("2020-08-16T21:06:23Z"), Description = "Mini Mart", Amount = -56.43, Status = "Completed"
                });
                db.Activities.Add(new V1.Activity {
                    DateTime = ConvertToDatetime("2020-06-15T18:17:23Z"), Description = "Country Railways", Amount = -167.78, Status = "Completed"
                });
                db.Activities.Add(new V1.Activity {
                    DateTime = ConvertToDatetime("2020-04-09T16:26:23Z"), Description = "Refund", Amount = 30.00, Status = "Completed"
                });
                db.Activities.Add(new V1.Activity {
                    DateTime = ConvertToDatetime("2020-04-01T12:47:23Z"), Description = "Amazon Online", Amount = -30.00, Status = "Completed"
                });
                db.Activities.Add(new V1.Activity {
                    DateTime = ConvertToDatetime("2020-03-30T23:53:23Z"), Description = "Bank Deposit", Amount = 500.00, Status = "Completed"
                });
                db.SaveChanges();
            }
        }
예제 #3
0
 public ActivityRepository(BlueDragonDbContext context)
     : base(context)
 {
 }
예제 #4
0
 public UnitOfWork(BlueDragonDbContext context)
 {
     this._context = context;
 }