// GET api/values public HttpResponseMessage Get(string gender = "All") { string username = Thread.CurrentPrincipal.Identity.Name;//here we are passing gender as username from fiddler switch (username) { case "male": return(Request.CreateResponse(HttpStatusCode.OK, employeeDetails.GetEmployees(username))); case "female": return(Request.CreateResponse(HttpStatusCode.OK, employeeDetails.GetEmployees(username))); default: return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }
public ActionResult AddPriority(string empId) { DataTable dtEmployee = EmployeeDetails.GetEmployees(empId); if (dtEmployee.Rows.Count == 0) { return(HttpNotFound()); } EmployeePriority empPriority = new EmployeePriority(); empPriority.EmployeeID = empId; empPriority.EmployeeName = dtEmployee.Rows[0]["EMPNAME"].ToString(); string maxPriority = EmployeeDetails.GetEmployeeMaxPriority(empId); empPriority.Priority = ((maxPriority == "") ? 1 : Convert.ToInt32(maxPriority) + 1).ToString(); return(View(empPriority)); }
public List <string> GetEmployeeList() { List <string> employeeList = new List <string>(); string[][] employees = _employeeDetails.GetEmployees(); foreach (string[] employee in employees) { employeeList.Add(employee[0]); employeeList.Add(","); employeeList.Add(employee[1]); employeeList.Add(","); employeeList.Add(employee[2]); employeeList.Add("\n"); } return(employeeList); }
// // GET: /DisplayPriority/ public ActionResult DisplayPriority(string empId) { EmployeePriority empPriority = new EmployeePriority(); empPriority.lstEmployees = new List <SelectListItem>(); DataTable dtEmployee = EmployeeDetails.GetEmployees(null); bool bIsValidEmployee = false; foreach (DataRow drEmp in dtEmployee.Rows) { empPriority.lstEmployees.Add(new SelectListItem { Text = drEmp["EMPNAME"].ToString(), Value = drEmp["EMPID"].ToString() }); if ((empId != null) && (empId == drEmp["EMPID"].ToString())) { bIsValidEmployee = true; } } if (empPriority.lstEmployees.Count > 0) { empPriority.lstEmployees.Add(new SelectListItem { Text = "All Employees", Value = "-1" }); } if ((empId == null) || ((empId != null) && (empPriority.lstEmployees.Count > 0) && (empId == "-1"))) { bIsValidEmployee = true; } if (!bIsValidEmployee) { return(RedirectToAction("ErrorMessage", "Error", new { message = "Employee Id is not valid!" })); } empPriority.SelectedEMPID = empId; return(View(empPriority)); }