Beispiel #1
0
        public async Task <IActionResult> PostEmployee(Employee employee)
        {
            DBStateKey updateState = await EmpService.AddNewEmployee(employee);

            if (updateState != DBStateKey.Success)
            {
                return(StatusCode(500, DBState[updateState]));
            }

            return(Ok(DBState[updateState]));
        }
Beispiel #2
0
        public async Task <ActionResult <Employee> > DeleteEmployee(int id)
        {
            DBStateKey updateState = await EmpService.DeleteEmployee(id);

            if (updateState != DBStateKey.Success)
            {
                return(StatusCode(500, DBState[updateState]));
            }

            return(Ok(DBState[updateState]));
        }
Beispiel #3
0
        public async Task <IActionResult> PutEmployeeAsync(int id, Employee employee)
        {
            DBStateKey updateState = await EmpService.UpdateEmployee(id, employee);

            if (updateState != DBStateKey.Success)
            {
                return(StatusCode(500, DBState[updateState]));
            }

            return(Ok(DBState[updateState]));
        }