Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,IDTraHang,IDPBSP,Imei,DonGia")] tb_WMS_ChiTietKhachTraHang tb_WMS_ChiTietKhachTraHang)
        {
            if (id != tb_WMS_ChiTietKhachTraHang.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tb_WMS_ChiTietKhachTraHang);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!tb_WMS_ChiTietKhachTraHangExists(tb_WMS_ChiTietKhachTraHang.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Imei"]      = new SelectList(_context.tb_WMS_IMEI, "ID", "ID", tb_WMS_ChiTietKhachTraHang.Imei);
            ViewData["IDTraHang"] = new SelectList(_context.tb_WMS_KhachTraHang, "ID", "ID", tb_WMS_ChiTietKhachTraHang.IDTraHang);
            ViewData["IDPBSP"]    = new SelectList(_context.tb_WMS_SanPhamPhienBan, "ID", "DungLuong", tb_WMS_ChiTietKhachTraHang.IDPBSP);
            return(View(tb_WMS_ChiTietKhachTraHang));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("ID,IDTraHang,IDPBSP,Imei,DonGia")] tb_WMS_ChiTietKhachTraHang tb_WMS_ChiTietKhachTraHang)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tb_WMS_ChiTietKhachTraHang);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Imei"]      = new SelectList(_context.tb_WMS_IMEI, "ID", "ID", tb_WMS_ChiTietKhachTraHang.Imei);
            ViewData["IDTraHang"] = new SelectList(_context.tb_WMS_KhachTraHang, "ID", "ID", tb_WMS_ChiTietKhachTraHang.IDTraHang);
            ViewData["IDPBSP"]    = new SelectList(_context.tb_WMS_SanPhamPhienBan, "ID", "DungLuong", tb_WMS_ChiTietKhachTraHang.IDPBSP);
            return(View(tb_WMS_ChiTietKhachTraHang));
        }