public async Task <IActionResult> Edit(int id, [Bind("Id,Url,Caption")] InventoryItemPhoto inventoryItemPhoto) { if (id != inventoryItemPhoto.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inventoryItemPhoto); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InventoryItemPhotoExists(inventoryItemPhoto.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(inventoryItemPhoto)); }
public async Task <IActionResult> Create([Bind("Id,Url,Caption")] InventoryItemPhoto inventoryItemPhoto) { if (ModelState.IsValid) { _context.Add(inventoryItemPhoto); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(inventoryItemPhoto)); }