Esempio n. 1
0
        public async Task <IActionResult> PutPhieucan(string id, Phieucan phieucan)
        {
            if (id != phieucan.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult <Phieucan> > PostPhieucan(Phieucan phieucan)
        {
            _context.Phieucan.Add(phieucan);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (PhieucanExists(phieucan.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetPhieucan", new { id = phieucan.Id }, phieucan));
        }