public async Task <IActionResult> Edit(int id, [Bind("ImpCode,AfghanistanAddress,ImpAcronym,ImpName,ImpNameDari,ImpNamePashto,ImpStatus,OtherAddress,RegistrationDate")] Implementers implementers) { if (id != implementers.ImpCode) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(implementers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ImplementersExists(implementers.ImpCode)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(implementers)); }
public async Task <IActionResult> Create([Bind("ImpCode,AfghanistanAddress,ImpAcronym,ImpName,ImpNameDari,ImpNamePashto,ImpStatus,OtherAddress,RegistrationDate")] Implementers implementers) { if (ModelState.IsValid) { _context.Add(implementers); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { ModelState.AddModelError(String.Empty, "Something went wrong maybe this id already exists."); return(View(implementers)); } return(RedirectToAction("Index")); } return(View(implementers)); }