public AdminController(IHttpContextAccessor httpContextAccessor, ApplicationDbContext context, IHostingEnvironment hostingEnvironment) { this._httpContextAccessor = httpContextAccessor; _hostingEnvironment = hostingEnvironment; this._context = context; this.cr = new CategoryRepo(context); this.gr = new GoodsRepo(context); this.ar = new AccountRepo(context); this.ag = new AccountGoodsRepo(context); this.og = new OrderRepo(context); }
public HomeController(IHttpContextAccessor httpContextAccessor, ApplicationDbContext context, UserManager <ApplicationUser> userManager) { this._httpContextAccessor = httpContextAccessor; this._context = context; // this._http = http; this.cr = new CategoryRepo(context); this.gr = new GoodsRepo(context); this.ar = new AccountRepo(context); this.ag = new AccountGoodsRepo(context); this.cartRepo = new CartRepo(context); this.amazon = new AmazonPriceScrapy(_context); _userManager = userManager; }
// Constructor. public TokenAPI( UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IConfiguration configuration, ApplicationDbContext context, IHostingEnvironment hostingEnvironment ) { this._context = context; _hostingEnvironment = hostingEnvironment; this.gr = new GoodsRepo(context); this.ag = new AccountGoodsRepo(context); cr = new CategoryRepo(context); _userManager = userManager; _signInManager = signInManager; _configuration = configuration; }
public ActionResult ShowGoods(int id) { ViewBag.MyViewBagList = cr.GetMenuList(); ViewBag.menuActive = "Gallery"; ViewBag.ViewedItems = cartRepo.GetViewedAll(User.getUserId()).ToList(); ViewBag.imgPath = ""; // I think I need to firgure out how to do the delete operation in the future. //foreach ( var good in gr.getAll().ToList()) //{ // if (good.goods_quantity == 0) // { // _context.Goodses.Remove(good); // _context.SaveChanges(); // } //} if (id == 0) { // ALL button ViewBag.goods = gr.getAll().ToList(); return(View(gr.getAll())); } if (id < 10) { // Get Goods From Parent ID var query = from n in gr.getAll() let tmp = cr.GetAll().Where(x => x.parent_id == id).Select(x => x.cat_id) where tmp.Contains(n.cat_id) select n; ViewBag.goods = query.ToList(); return(View(query)); } ViewBag.goods = GoodsRepo.GetGoodsByCatID(gr.getAll(), id); return(View(GoodsRepo.GetGoodsByCatID(gr.getAll(), id))); }
public AccountController( UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IEmailSender emailSender, ILogger <AccountController> logger, IHttpContextAccessor httpContextAccessor, ApplicationDbContext context, IServiceProvider serviceProvider ) { _userManager = userManager; _signInManager = signInManager; _emailSender = emailSender; _logger = logger; this._httpContextAccessor = httpContextAccessor; this._context = context; _serviceProvider = serviceProvider; this.cr = new CategoryRepo(context); this.gr = new GoodsRepo(context); this.ar = new AccountRepo(context); this.ag = new AccountGoodsRepo(context); }
public ActionResult Search(string search) { //return View(GoodsRepo.SearchGoodsByStr(search)); return(View(GoodsRepo.FilterGoods(gr.getAll(), search))); }
public ActionResult SortIndex(int id, string sortOrder) { ViewBag.ViewedItems = cartRepo.GetViewedAll(User.getUserId()).ToList(); ViewBag.MyViewBagList = cr.GetMenuList(); // Store current sort filter parameter. ViewBag.CurrentSort = sortOrder; ViewBag.menuActive = "Home"; switch (sortOrder) { case GoodsRepo.NAME: ViewBag.NameSortParm = GoodsRepo.NAME_DESC; ViewBag.DateSortParm = GoodsRepo.DATE; ViewBag.IdSortParm = GoodsRepo.ID; break; case GoodsRepo.NAME_DESC: ViewBag.NameSortParm = GoodsRepo.NAME; ViewBag.DateSortParm = GoodsRepo.DATE; ViewBag.IdSortParm = GoodsRepo.ID; break; case GoodsRepo.ID: ViewBag.IdSortParm = GoodsRepo.ID_DESC; ViewBag.NameSortParm = GoodsRepo.NAME; ViewBag.DateSortParm = GoodsRepo.DATE; break; case GoodsRepo.ID_DESC: ViewBag.IdSortParm = GoodsRepo.ID; ViewBag.NameSortParm = GoodsRepo.NAME; ViewBag.DateSortParm = GoodsRepo.DATE; break; case GoodsRepo.DATE: ViewBag.DateSortParm = GoodsRepo.DATE_DESC; ViewBag.IdSortParm = GoodsRepo.ID; ViewBag.NameSortParm = GoodsRepo.NAME; break; case GoodsRepo.DATE_DESC: ViewBag.DateSortParm = GoodsRepo.DATE; ViewBag.IdSortParm = GoodsRepo.ID; ViewBag.NameSortParm = GoodsRepo.NAME; break; default: ViewBag.DateSortParm = GoodsRepo.DATE; ViewBag.IdSortParm = GoodsRepo.ID; ViewBag.NameSortParm = GoodsRepo.NAME; break; } if (id == 0) { // ALL Goods, By sortOrder return(View(GoodsRepo.SortGoods(gr.getAll(), sortOrder))); } if (id < 10) { // Get Goods From Parent ID var query = from n in gr.getAll() let tmp = cr.GetAll().Where(x => x.parent_id == id).Select(x => x.cat_id) where tmp.Contains(n.cat_id) select n; return(View(GoodsRepo.SortGoods(query, sortOrder))); } // Get goods by cat_id and sortOrder return(View(GoodsRepo.SortGoods(GoodsRepo.GetGoodsByCatID(gr.getAll(), id), sortOrder))); }