Ejemplo n.º 1
0
        public async Task <IActionResult> PutConductorItem(string identificacion, ConductorItem item)
        {
            if (identificacion != item.Identificacion)
            {
                return(BadRequest());
            }

            _context.Entry(item).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <ConductorItem> > PostConductorItem(ConductorItem item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Error"));
            }

            //var clienteItem = await _context.ClienteItems.FindAsync(id);

            //if(clienteItem!=null)
            //{
            //  return BadRequest("Ya la persona esta registrada");
            //}

            _context.ConductorItems.Add(item);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetConductorItem), new { id = item.Identificacion }, item));
        }