Exemplo n.º 1
0
        public async Task <IActionResult> PutGetsInfoFrom(int id, GetsInfoFrom getsInfoFrom)
        {
            if (id != getsInfoFrom.ReservationSystemId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <GetsInfoFrom> > PostGetsInfoFrom(GetsInfoFrom getsInfoFrom)
        {
            _context.GetsInfoFrom.Add(getsInfoFrom);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (GetsInfoFromExists(getsInfoFrom.ReservationSystemId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetGetsInfoFrom", new { id = getsInfoFrom.ReservationSystemId }, getsInfoFrom));
        }