Ejemplo n.º 1
0
        public async Task <IActionResult> PutEbridge(short id, Ebridge ebridge)
        {
            if (id != ebridge.EbridgeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <Ebridge> > PostEbridge(Ebridge ebridge)
        {
            _context.Ebridge.Add(ebridge);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EbridgeExists(ebridge.EbridgeId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEbridge", new { id = ebridge.EbridgeId }, ebridge));
        }