public async Task <IActionResult> Create([Bind("Id,Name,Desc,Image,Snapshot")] Artwork artwork) { if (ModelState.IsValid) { artwork.CreatedAt = DateTime.Now; if (artwork.Id == 0) { _context.Add(artwork); } else { _context.Update(artwork); } await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(artwork)); }
public void Update(Artwork artwork) { _context.Update(artwork); }