예제 #1
0
        public ActionResult <string> Post(string orgID, string id, SearchObject searchObject)
        {
            searchObject.Id = id.Replace("\"", "");
            List <string> employees = null;

            try
            {
                Console.WriteLine(searchObject.Date);
                if (searchObject.Category.Equals("Floor"))
                {
                    int floor = int.Parse(searchObject.Input);
                    employees = searchObject.GetEmployeeByFloor(floor, orgID);
                    return(new OkObjectResult(employees));
                }
                else if (searchObject.Category.Equals("Department"))
                {
                    employees = searchObject.GetEmployeeByDeparment(searchObject.Input, orgID);
                    return(new OkObjectResult(employees));
                }
                else if (searchObject.Category.Equals("EmployeeName"))
                {
                    employees = searchObject.GetEmployeeByName(searchObject.Input, orgID);
                    return(new OkObjectResult(employees));
                }
                else
                {
                    return(new OkResult());
                }
            }
            catch (Exception e)
            {
                return(new BadRequestObjectResult("Fail to search on these values " + e.Message));
            }
        }