예제 #1
0
        public async Task <IActionResult> PutTbasePlacedElement(short id, TbasePlacedElement tbasePlacedElement)
        {
            if (id != tbasePlacedElement.TbasePlacedElementId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <TbasePlacedElement> > PostTbasePlacedElement(TbasePlacedElement tbasePlacedElement)
        {
            _context.TbasePlacedElement.Add(tbasePlacedElement);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TbasePlacedElementExists(tbasePlacedElement.TbasePlacedElementId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTbasePlacedElement", new { id = tbasePlacedElement.TbasePlacedElementId }, tbasePlacedElement));
        }