public async Task <IHttpActionResult> GetSingleEmployee(string id)
        {
            id = id.Trim();
            var viewModel = await _employeeOrchestrator.SearchEmployee(id);

            if (viewModel.RecordGuid == Guid.Empty)
            {
                return(Content(HttpStatusCode.NotFound, "Error 404: Employee Id Not Found"));
            }

            else
            {
                EmployeeDetail emp = new EmployeeDetail();
                emp.FirstName  = viewModel.FirstName;
                emp.MiddleName = viewModel.MiddleName;
                emp.LastName   = viewModel.LastName;
                emp.BirthDate  = viewModel.BirthDate.ToShortDateString();
                emp.Department = viewModel.Department;

                return(Ok(emp));
            }
        }
예제 #2
0
        public async Task <JsonResult> Search(string searchString)
        {
            var viewModel = await _employeeOrchestrator.SearchEmployee(searchString);

            return(Json(viewModel, JsonRequestBehavior.AllowGet));
        }