Exemplo n.º 1
0
        public async Task <IActionResult> Posttransportation_types([FromBody] transportation_types transportation_types)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.transportation_types.Add(transportation_types);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Gettransportation_types", new { id = transportation_types.id }, transportation_types));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Puttransportation_types([FromRoute] int id, [FromBody] transportation_types transportation_types)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != transportation_types.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }