Пример #1
0
        public async Task <ActionResult <TblWorker> > PostTblWorker(TblWorker tblWorker)
        {
            _context.TblWorker.Add(tblWorker);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTblWorker", new { id = tblWorker.IdWorker }, tblWorker));
        }
Пример #2
0
        public async Task <IActionResult> PutTblWorker(int id, TblWorker tblWorker)
        {
            if (id != tblWorker.IdWorker)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }