public async Task <IActionResult> PutPhieudathang(string id, Phieudathang phieudathang)
        {
            if (id != phieudathang.Id)
            {
                return(BadRequest());
            }

            _context.Entry(phieudathang).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PhieudathangExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 2
0
        public List <Phieudathang> LoadPhieudathangList()
        {
            List <Phieudathang> list = new List <Phieudathang>();

            DataTable data = QLPhieuDAL.Instance.LoadPhieudathangList();

            foreach (DataRow item in data.Rows)
            {
                Phieudathang info = new Phieudathang(item);
                list.Add(info);
            }
            return(list);
        }
        public async Task <ActionResult <Phieudathang> > PostPhieudathang(Phieudathang phieudathang)
        {
            _context.Phieudathangs.Add(phieudathang);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (PhieudathangExists(phieudathang.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetPhieudathang", new { id = phieudathang.Id }, phieudathang));
        }