Ejemplo n.º 1
0
 public IHttpActionResult Put(int key, Employee employee)
 {
     Employee originalEmployee = Employees.Single(e => e.Id == key);
     employee.Id = key;
     Employees.Remove(originalEmployee);
     Employees.Add(employee);
     return Ok(employee);
 }
Ejemplo n.º 2
0
        public static IList<Employee> InitEmployees()
        {
            IList<Employee> employees = new List<Employee>();
            Employee employee = new Employee() { Id = 1, Name = "Name1" };
            employee.Account = AccountsController.Accounts.Single(a => a.Id == 1);
            employees.Add(employee);

            Manager mananger = new Manager { Id = 2, Name = "Name2", Heads = 1 };
            mananger.DynamicProperties.Add("Level", 1);
            mananger.DynamicProperties.Add("Gender", Gender.Male);
            mananger.DynamicProperties.Add("PhoneNumbers", new List<string>() { "8621-8888-8888", "8610-6666-6666" });
            employees.Add(mananger);

            return employees;
        }
Ejemplo n.º 3
0
 public IHttpActionResult Post(Employee employee)
 {
     employee.Id = Employees.Count + 1;
     Employees.Add(employee);
     return Created(employee);
 }