Exemplo n.º 1
0
        public async Task <IActionResult> PutAirball(int id, Airball airball)
        {
            if (id != airball.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <Airball> > PostAirball(Airball airball)
        {
            try
            {
                var i = _context.Airballs.Add(airball);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetAirball", new { id = airball.Id }, airball));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }