예제 #1
0
        /// <summary>
        /// Loads the employee list
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> Index()
        {
            EmployeeDataAPIProxy employeeProxy = new EmployeeDataAPIProxy(this._serviceContext, this._httpClient, this._fabricClient);

            List <Employee> employees = await employeeProxy.GetEmployees();

            EmployeeViewModel viewModel = new EmployeeViewModel();

            viewModel.EmployeeList = employees;

            return(View(viewModel));
        }
예제 #2
0
        public async Task <IActionResult> Delete(long?id)
        {
            EmployeeViewModel viewModel = new EmployeeViewModel();

            EmployeeDataAPIProxy employeeProxy = new EmployeeDataAPIProxy(this._serviceContext, this._httpClient, this._fabricClient);

            if (id != null)
            {
                await employeeProxy.DeleteEmployee(id.Value);
            }

            List <Employee> employees = await employeeProxy.GetEmployees();

            viewModel.EmployeeList = employees;

            return(View("Index", viewModel));
        }
예제 #3
0
        public async Task <IActionResult> Create(EmployeeViewModel employeeViewModel)
        {
            EmployeeDataAPIProxy employeeProxy = new EmployeeDataAPIProxy(this._serviceContext, this._httpClient, this._fabricClient);;

            if (ModelState.IsValid)
            {
                //Not for production at all.
                EmployeeId = EmployeeId + 1;

                employeeViewModel.Employee.Id = EmployeeId;

                await employeeProxy.CreateEmployee(employeeViewModel.Employee);
            }

            List <Employee> employees = await employeeProxy.GetEmployees();

            employeeViewModel.EmployeeList = employees;

            return(View("Index", employeeViewModel));
        }