Пример #1
0
        public MainWindow()
        {
            InitializeComponent();

            p = new Presenter(this);

            //Initialize cbDepList
            ObservableCollection <Department> depList = p.GetDepList();

            foreach (var dep in depList)
            {
                cbDepartmentsList.Items.Add($"{dep.Name}, {dep.Location}, {dep.Salary}");
            }

            ////Dep
            btnNewDep.Click    += delegate { p.AddDepartment(); };
            btnDeleteDep.Click += delegate { p.DeleteDepartment(); };


            ////Emp
            btnNewEmp.Click             += delegate { p.AddEmployee(); };
            btnDeleteEmp.Click          += delegate { p.DeleteEmployee(); };
            lvEmployee.SelectionChanged += delegate { p.RefreshDepartmentsListOnEMP(); };
            btnAddDepToEMP.Click        += delegate { p.AddDepartmentToEMP(); };
            btnDelDepFromEMP.Click      += delegate { p.DeleteDepartmentFromEMP(); };
        }
 public HttpResponseMessage Post([FromBody] Department value)
 {
     if (pr.AddDepartment(value))
     {
         return(Request.CreateResponse(HttpStatusCode.Created));
     }
     else
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest));
     }
 }
Пример #3
0
        public MainWindow()
        {
            InitializeComponent();
            p = new Presenter(this);
            p.LoadData();

            btnAddDep.Click  += delegate { p.AddDepartment(); };
            btnAddEmp.Click  += delegate { p.AddEmloyee(); };
            btnEditDep.Click += delegate
            {
                new EditDepartmentWindow(DepartmentView.SelectedItem as Department).ShowDialog();
            };
        }