public async Task <IActionResult> PutSimpleLiteral(long id, SimpleLiteral simpleLiteral)
        {
            if (id != simpleLiteral.SimpleLiteralId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <ActionResult <SimpleLiteral> > PostSimpleLiteral(SimpleLiteral simpleLiteral)
        {
            _context.SimpleLiteral.Add(simpleLiteral);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (SimpleLiteralExists(simpleLiteral.SimpleLiteralId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetSimpleLiteral", new { id = simpleLiteral.SimpleLiteralId }, simpleLiteral));
        }
예제 #3
0
        public Node List()
        {
            var initList      = Expect(TokenCategory.INITLIST);
            var simpleLitList = new SimpleLiteralList();
            var litToken      = new SimpleLiteral();

            if (CurrentToken == TokenCategory.INTEGERLITERAL | CurrentToken == TokenCategory.STRINGLITERAL | CurrentToken == TokenCategory.FALSELITERAL | CurrentToken == TokenCategory.FALSELITERAL)
            {
                litToken.Add(SimpleLiteral());
                while (CurrentToken == TokenCategory.COMMA)
                {
                    Expect(TokenCategory.COMMA);
                    simpleLitList.Add(SimpleLiteral());
                }
            }
            Expect(TokenCategory.CLOSINGLIST);
            var result = new List()
            {
                litToken, simpleLitList
            };

            result.AnchorToken = initList;
            return(result);
        }