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