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