public async Task <IActionResult> Edit(string id, [Bind("Category,Id,CreatedAt")] CategoriaProdotti categoriaProdotti) { if (id != categoriaProdotti.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(categoriaProdotti); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoriaProdottiExists(categoriaProdotti.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(categoriaProdotti)); }
public async Task <IActionResult> Create([Bind("Category,Id,CreatedAt")] CategoriaProdotti categoriaProdotti) { if (ModelState.IsValid) { _context.Add(categoriaProdotti); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(categoriaProdotti)); }