Exemplo n.º 1
0
        public void SetAddress(int employeeId, string address)
        {
            var employee = context.Employees.Find(employeeId);

            if (employee == null)
            {
                throw new ArgumentException("Invalid Id");
            }

            employee.Address = address;

            context.SaveChanges();
        }
Exemplo n.º 2
0
        public void SetManager(int employeeId, int managerId)
        {
            Employee employee = this.context.Employees.Find(employeeId);

            Employee manager = this.context.Employees.Find(managerId);

            if (employee == null)
            {
                throw new ArgumentException("Invalid employee Id");
            }

            employee.Manager = manager ?? throw new ArgumentException("Invalid manager Id");
            context.SaveChanges();
        }