public ActionResult Index() { MyStoreContext _myStoreContext = new MyStoreContext(); var employeeDetails = (from emp in _myStoreContext.Employee join dept in _myStoreContext.Department on emp.DepartmentId equals dept.DepartmentId orderby dept.Name select new EmployeeDetailsViewModel { Name = emp.Name, Description = emp.Description, DepartmentName = dept.Name }).ToList(); EmployeeDepartmentDetailsViewModel employeeDepartmentDetails = new EmployeeDepartmentDetailsViewModel { Employees = employeeDetails }; return(View(employeeDepartmentDetails)); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime, MyStoreContext myStoreContext) { 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.UseAuthentication(); app.UseMiddleware <ErrorHandlerMiddleware>(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseHealthChecks("/health"); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "MyStore API v1")); // app.Use(async (ctx, next) => // { // Console.WriteLine("BEFORE"); // await next(); // }); // app.Run(async ctx => // { // Console.WriteLine("RUN"); // await Task.CompletedTask; // }); app.UseMvc(); myStoreContext.Database.EnsureCreated(); lifetime.ApplicationStopped.Register(() => Container.Dispose()); }
public GenericRepository(MyStoreContext context) { _entities = context; }
public LoginController(MyStoreContext context) { this._context = context; this._secretString = "MySecretsmlkmfwlemfmeewjhevryqbouhtipuhaoifbreuafbuafieunquuenfu"; }
public UnitOfWork() { this._context = new MyStoreContext(); }
public ProductController(MyStoreContext context) { _context = context; }
public PictureRepository(MyStoreContext context) { _context = context; }
public MenuItemsController(MyStoreContext context) { _context = context; }
public EfProductRepository(MyStoreContext context) { _context = context; }
public CustomRoleStore(MyStoreContext context) : base(context) { }
public CustomUserStore(MyStoreContext context) : base(context) { }
public OrderController(MyStoreContext context) { _context = context; }
public CustomerController(MyStoreContext context) { _context = context; }
public CategoryRepository(MyStoreContext context) { _context = context; }
public EfCategoryRepository(MyStoreContext mySotreContext) { _ctx = mySotreContext; }
public ProductsController(MyStoreContext context) => _context = context;
public EmployeesController(MyStoreContext context) { _context = context; }
public EfProductRepository(MyStoreContext mySotreContext) { _ctx = mySotreContext; }
private void ReInitRepo() { var context = new MyStoreContext(); _repository = new ShoppingCartRepository(context); }
public HomeController(MyStoreContext context) { _context = context; }
public OrderRepository(MyStoreContext context) { _context = context; }
public PurchasesController(MyStoreContext context) => _context = context;
public ShoppingCartRepository(MyStoreContext context) { _context = context; }
public TimeSheetsController(MyStoreContext context) { _context = context; }
public UserRepository(MyStoreContext context) { _context = context; _userManager = new UserManager <User, Guid>(new CustomUserStore(context)); }
public CheckoutController(MyStoreContext context) => _context = context;
public MarkRepository(MyStoreContext context) { _context = context; }
public EfOrderRepository(MyStoreContext myStoreContext) { _ctx = myStoreContext; }