コード例 #1
0
        public async Task <IActionResult> PutGoiVip(int id, GoiVip goiVip)
        {
            if (id != goiVip.Idgoi)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <GoiVip> > PostGoiVip(GoiVip goiVip)
        {
            _context.GoiVips.Add(goiVip);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (GoiVipExists(goiVip.Idgoi))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetGoiVip", new { id = goiVip.Idgoi }, goiVip));
        }