Ejemplo n.º 1
0
        public async Task <IActionResult> PutPoline(int id, Poline poline)
        {
            if (id != poline.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutEmployee(int id, Employee employee)
        {
            //make sure IDs match so you are updating correct file
            if (id != employee.Id)
            {
                return(BadRequest());
            }
            //takes passed in data, to read it then change it
            _context.Entry(employee).State = EntityState.Modified;

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

            return(NoContent());
        }