예제 #1
0
        public async Task <IActionResult> PutTocpArea(long id, TocpArea tocpArea)
        {
            if (id != tocpArea.TocpAreaId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <TocpArea> > PostTocpArea(TocpArea tocpArea)
        {
            _context.TocpArea.Add(tocpArea);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TocpAreaExists(tocpArea.TocpAreaId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTocpArea", new { id = tocpArea.TocpAreaId }, tocpArea));
        }