コード例 #1
0
        public async Task <IActionResult> PutTbaseServiceSection(short id, TbaseServiceSection tbaseServiceSection)
        {
            if (id != tbaseServiceSection.TbaseServiceSectionId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <TbaseServiceSection> > PostTbaseServiceSection(TbaseServiceSection tbaseServiceSection)
        {
            _context.TbaseServiceSection.Add(tbaseServiceSection);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TbaseServiceSectionExists(tbaseServiceSection.TbaseServiceSectionId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTbaseServiceSection", new { id = tbaseServiceSection.TbaseServiceSectionId }, tbaseServiceSection));
        }