public async Task <IActionResult> Edit(int id, [Bind("ProductCategoryId,ProductCategoryName")] PtsProductCategory ptsProductCategory) { if (id != ptsProductCategory.ProductCategoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ptsProductCategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PtsProductCategoryExists(ptsProductCategory.ProductCategoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(ptsProductCategory)); }
public async Task <IActionResult> Create([Bind("ProductCategoryId,ProductCategoryName")] PtsProductCategory ptsProductCategory) { if (ModelState.IsValid) { _context.Add(ptsProductCategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(ptsProductCategory)); }