示例#1
0
        public async Task <IActionResult> PutKa(int id, Ka ka)
        {
            if (id != ka.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> PutEmployee(int id, Employee employee)
        {
            if (id != employee.Id)
            {
                return(BadRequest());
            }

            _context.Kas.Attach(employee.Ka);
            _context.Entry(employee).State = EntityState.Modified;

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

            return(NoContent());
        }