Ejemplo n.º 1
0
        public async Task <ActionResult <CgiShift> > PostCgiShift(CgiShift cgiShift)
        {
            _context.CgiShift.Add(cgiShift);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetCgiShift), new { id = cgiShift.Id }, cgiShift));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutCgiShift(int id, CgiShift cgiShift)
        {
            if (id != cgiShift.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }