public async Task <IActionResult> Edit(int id, ProductTypes pt) { if (id != pt.Id) { return(NotFound()); } if (ModelState.IsValid) { if (orm == 1) { qdb.upproducttype(pt); } else { _db.Update(pt); await _db.SaveChangesAsync(); } TempData["edit"] = 1; return(RedirectToAction(nameof(Index))); } return(View(pt)); }