// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, HelpLocallyContext _context, IPasswordHasher <User> _hasher) { //_context.Database.EnsureDeleted(); if (_context.Database.EnsureCreated()) { var roleAdmin = new Role(1, Roles.Admin); var roleCustomer = new Role(2, Roles.Customer); var roleCompany = new Role(3, Roles.Company); _context.Roles.Add(roleAdmin); _context.Roles.Add(roleCustomer); _context.Roles.Add(roleCompany); var user = new User("admin"); user.PasswordHash = _hasher.HashPassword(user, "12345"); var userRole = new UserRole { User = user, UserId = user.Id, Role = roleAdmin, RoleId = roleAdmin.Id }; user.UserRoles.Add(userRole); _context.Add(user); _context.Add(new OfferType(1, "Voucher", "Do wykorzysatnia w przysz³oœci")); _context.SaveChanges(); } if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); }); }
public BaseService(HelpLocallyContext context) { _context = context; }
public CreateModel(HelpLocallyContext context) { _context = context; }
public IndexModel(HelpLocallyContext context) { _context = context; }
public IdentityService(HelpLocallyContext context) : base(context) { }
public CreateModel(HelpLocallyContext context, IPasswordHasher <User> hasher) { _context = context; _hasher = hasher; }
public OfferService(HelpLocallyContext context) : base(context) { }
public UserService(HelpLocallyContext context) { _context = context; }
public CompanyService(HelpLocallyContext context) : base(context) { }
public OffersModel(HelpLocallyContext context) { _context = context; }
public DetailsModel(HelpLocallyContext context, OfferService offerService, UserService userService) { _context = context; _offerService = offerService; _userService = userService; }
public UserSigningModel(HelpLocallyContext context, IConfiguration config) { _context = context; _config = config; }
public EditModel(HelpLocallyContext context) { _context = context; }
public AddModel(HelpLocallyContext context) { _context = context; }
public UserRegistrationModel(HelpLocallyContext context) { _context = context; }
public RemoveModel(HelpLocallyContext context) { _context = context; }