Ejemplo n.º 1
0
        public async Task <IActionResult> PutTbridge(short id, Tbridge tbridge)
        {
            if (id != tbridge.TbridgeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <Tbridge> > PostTbridge(Tbridge tbridge)
        {
            _context.Tbridge.Add(tbridge);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TbridgeExists(tbridge.TbridgeId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTbridge", new { id = tbridge.TbridgeId }, tbridge));
        }