public async Task <IActionResult> Edit(int id, [Bind("AdoptId,ChildFullName,AdoptFullName,CitizenshipofAdopter,Ageofchild,AdopterphoneNumber,ReasonforAdoption,Sexofchild,IssueDate,Cid")] Adoptiontbl adoptiontbl) { if (id != adoptiontbl.AdoptId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(adoptiontbl); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AdoptiontblExists(adoptiontbl.AdoptId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Cid"] = new SelectList(_context.Custometbl, "Cid", "Fname", adoptiontbl.Cid); return(View(adoptiontbl)); }
public async Task <IActionResult> Create([Bind("AdoptId,ChildFullName,AdoptFullName,CitizenshipofAdopter,Ageofchild,AdopterphoneNumber,ReasonforAdoption,Sexofchild,IssueDate,Cid")] Adoptiontbl adoptiontbl) { if (ModelState.IsValid) { _context.Add(adoptiontbl); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Cid"] = new SelectList(_context.Custometbl, "Cid", "Fname", adoptiontbl.Cid); return(View(adoptiontbl)); }