public async Task <IActionResult> Edit(string id, [Bind("BdgMa,BdgNoidung,BdgLuotthich,BdgTk")] Baidanhgia baidanhgia) { if (id != baidanhgia.BdgMa) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(baidanhgia); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BaidanhgiaExists(baidanhgia.BdgMa)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BdgTk"] = new SelectList(_context.Taikhoan, "TkMa", "TkMa", baidanhgia.BdgTk); return(View(baidanhgia)); }
public async Task <IActionResult> Create([Bind("BdgMa,BdgNoidung,BdgLuotthich,BdgTk")] Baidanhgia baidanhgia) { if (ModelState.IsValid) { _context.Add(baidanhgia); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BdgTk"] = new SelectList(_context.Taikhoan, "TkMa", "TkMa", baidanhgia.BdgTk); return(View(baidanhgia)); }