public async Task <IActionResult> Create([Bind("ArtistArtworkId,Name,InStock,ImgUrl,ArtworkPrice,ArtistId")] ArtistArtwork artwork) { _context.ArtistArtwork.Add(artwork); await _context.SaveChangesAsync(); return(RedirectToAction("GetAllArtwork", "ArtistArtworks")); }
public async Task <IActionResult> Edit(int id, [Bind("ArtistArtworkId,Name,InStock,ImgUrl,ArtworkPrice,ArtistId")] ArtistArtwork artistArtwork) { if (id != artistArtwork.ArtistArtworkId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(artistArtwork); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArtistArtworkExists(artistArtwork.ArtistArtworkId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ArtistId"] = new SelectList(_context.Artist, "ArtistId", "ArtistId", artistArtwork.ArtistId); return(View(artistArtwork)); }
// GET: ArtistArtworks/Create public IActionResult Create() { ArtistArtwork artwork = new ArtistArtwork(); return(View(artwork)); }