Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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));
        }