コード例 #1
0
        public async Task <IActionResult> PutTurnos(int id, Turnos Turnos)
        {
            if (id != Turnos.CG_TURNO)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <Turnos> > PostTurnos(Turnos Turnos)
        {
            _context.Turnos.Add(Turnos);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TurnosExists(Turnos.CG_TURNO))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTurnos", new { id = Turnos.CG_TURNO }, Turnos));
        }