Esempio n. 1
0
        public async Task <IActionResult> PutTelectricalWagonCouplerType(long id, TelectricalWagonCouplerType telectricalWagonCouplerType)
        {
            if (id != telectricalWagonCouplerType.TelectricalWagonCouplerTypeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult <TelectricalWagonCouplerType> > PostTelectricalWagonCouplerType(TelectricalWagonCouplerType telectricalWagonCouplerType)
        {
            _context.TelectricalWagonCouplerType.Add(telectricalWagonCouplerType);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TelectricalWagonCouplerTypeExists(telectricalWagonCouplerType.TelectricalWagonCouplerTypeId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTelectricalWagonCouplerType", new { id = telectricalWagonCouplerType.TelectricalWagonCouplerTypeId }, telectricalWagonCouplerType));
        }