/// <summary> /// Actions when 'Delete' button is clicked /// </summary> public async void Delete() { Employee employee = new Employee(); employee.Id = Convert.ToInt32(employeeView.IdEmployeeText); await EmployeeHelper.Delete(employee); await ListAllEmployees(); }
public IActionResult DeleteEmployee(string code) { if (code == null) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = $"{nameof(code)}can not be null" })); } try { var result = EmployeeHelper.Delete(code); APIResponse apiResponse; if (result != null) { apiResponse = new APIResponse() { status = APIStatus.PASS.ToString(), response = result }; } else { apiResponse = new APIResponse() { status = APIStatus.FAIL.ToString(), response = "Deletion Failed." }; } return(Ok(apiResponse)); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }
public ActionResult Delete(int id, IFormCollection collection) { _employeeHelper.Delete(id); return(RedirectToAction("Index")); }