public async Task <IActionResult> PutLanesCatalog(string id, string id2, LanesCatalog lanesCatalog)
        {
            if (id != lanesCatalog.CapufeLaneNum && id2 != lanesCatalog.IdGare)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LanesCatalogExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <LanesCatalog> > PostLanesCatalog(LanesCatalog lanesCatalog)
        {
            _context.LanesCatalogs.Add(lanesCatalog);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLanesCatalog", new { id = lanesCatalog.CapufeLaneNum }, lanesCatalog));
        }
        public async Task <ActionResult <LanesCatalog> > PostLanesCatalog([FromBody] LanesCatalog lanesCatalog)
        {
            _context.LanesCatalogs.Add(lanesCatalog);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (LanesCatalogExists(lanesCatalog.CapufeLaneNum))
                {
                    return(Content("Existe"));
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetLanesCatalog", new { id = lanesCatalog.CapufeLaneNum, id2 = lanesCatalog.IdGare }, lanesCatalog));
        }