public async Task <IActionResult> Edit(int id, [Bind("IsDislike,CollectorId,ItemId")] CollectorLikes collectorLikes) { if (id != collectorLikes.CollectorId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(collectorLikes); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CollectorLikesExists(collectorLikes.CollectorId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CollectorId"] = new SelectList(_context.Collectors, "CollectorId", "CollectorId", collectorLikes.CollectorId); ViewData["ItemId"] = new SelectList(_context.Items, "ItemId", "ItemId", collectorLikes.ItemId); return(View(collectorLikes)); }
public async Task <IActionResult> Create([Bind("IsDislike,CollectorId,ItemId")] CollectorLikes collectorLikes) { if (ModelState.IsValid) { _context.Add(collectorLikes); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CollectorId"] = new SelectList(_context.Collectors, "CollectorId", "CollectorId", collectorLikes.CollectorId); ViewData["ItemId"] = new SelectList(_context.Items, "ItemId", "ItemId", collectorLikes.ItemId); return(View(collectorLikes)); }