コード例 #1
0
        public async Task <ActionResult <Scrap> > PostScrap(Scrap Scrap)
        {
            _context.Scrap.Add(Scrap);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ScrapExists(Scrap.CG_SCRAP))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetScrap", new { id = Scrap.CG_SCRAP }, Scrap));
        }