// GET: Ads/Create public IActionResult Create() { AdsRepo adRepo = new AdsRepo(_context); string userId = User.FindFirst(ClaimTypes.NameIdentifier).Value; ViewData["VendorID"] = adRepo.getVendorID(userId); return(View()); }
// GET: Ads public IActionResult Index() { AdsRepo adRepo = new AdsRepo(_context); string userId = User.FindFirst(ClaimTypes.NameIdentifier).Value; var es = adRepo.GetAll(userId); var esList = es.ToList(); return(View(es)); // var applicationDbContext = _context.Ads.Include(a => a.Vendor); // return View(await applicationDbContext.ToListAsync()); }
// GET: Ads/Edit/5 public async Task <IActionResult> Edit(int?id) { AdsRepo adRepo = new AdsRepo(_context); string userId = User.FindFirst(ClaimTypes.NameIdentifier).Value; ViewData["VendorID"] = adRepo.getVendorID(userId); if (id == null) { return(NotFound()); } var ad = await _context.Ads.FindAsync(id); if (ad == null) { return(NotFound()); } return(View(ad)); }