// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, NGContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { HotModuleReplacement = true, ReactHotModuleReplacement = true }); } else { app.UseExceptionHandler("/Home/Error"); } AutoMapper.Mapper.Initialize(c => { c.CreateMap <Customer, CustomerDetailDto>().AfterMap((s, d) => { d.OpenDate = s.OpenDate.ToString("dd-MM-yyyy"); }); c.CreateMap <Customer, CustomerViewDto>(); c.CreateMap <Account, AccountDto>().AfterMap((s, d) => { d.Balance = s.Balance.ToString("c", CultureInfo.CreateSpecificCulture(s.Currency.Culture)); }); c.CreateMap <AccountCreateDto, Account>(); c.CreateMap <ClassCode, ClassCodeDto>().AfterMap((s, d) => { d.ClassCode = s.Code; }); }); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); routes.MapRoute( name: "api", template: "api/*"); routes.MapSpaFallbackRoute( name: "spa-fallback", defaults: new { controller = "Home", action = "Index" }); }); }
public static void RestSeed(this NGContext context) { //delete tables context.AccountTypes.RemoveRange(context.AccountTypes); context.ClassCodes.RemoveRange(context.ClassCodes); context.Currencies.RemoveRange(context.Currencies); context.Customers.RemoveRange(context.Customers); context.Accounts.RemoveRange(context.Accounts); context.SaveChanges(); //generate data IEnumerable <AccountType> AccountTypes = CreateAccountTypes(); context.AccountTypes.AddRange(AccountTypes); context.SaveChanges(); IEnumerable <ClassCode> ClassCodes = CreateClassCodes(AccountTypes); context.ClassCodes.AddRange(ClassCodes); context.SaveChanges(); IEnumerable <Currency> Currencies = CreateCurrencies(); context.Currencies.AddRange(Currencies); context.SaveChanges(); IEnumerable <Customer> Customers = CreateCustomers(); context.Customers.AddRange(Customers); context.SaveChanges(); IEnumerable <Account> Accounts = CreateAccounts(Customers, AccountTypes.ToArray(), ClassCodes.ToArray(), Currencies.ToArray()); context.Accounts.AddRange(Accounts); context.SaveChanges(); }
public ConstantsController(NGContext NGContext) { this.NGContext = NGContext; }
public CustomersController(NGContext NGContext) { this.NGContext = NGContext; }
public SeedController(NGContext NGContext) { this.NGContext = NGContext; }