public async Task <IActionResult> Edit(int id, [Bind("Id,Detail,DescriptionId")] DesDetails desDetails) { if (id != desDetails.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(desDetails); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DesDetailsExists(desDetails.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DescriptionId"] = new SelectList(_context.Description, "Id", "Title", desDetails.DescriptionId); return(View(desDetails)); }
public async Task <IActionResult> Create([Bind("Id,Detail,DescriptionId")] DesDetails desDetails) { if (ModelState.IsValid) { _context.Add(desDetails); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DescriptionId"] = new SelectList(_context.Description, "Id", "Title", desDetails.DescriptionId); return(View(desDetails)); }