public async Task <IActionResult> GetEmployeesWithSubmittedAppraisal(int employeeid, string whoami, [FromQuery] AppraisalQueryParam model) { try { var configExist = await appraisalResult.CheckAppraisalConfigurationDetails(model); if (!configExist) { return(NotFound(new { error = "Appraisal configuration details not found" })); } var result = await appraisalResult.GetEmployeesToAppraise(employeeid, model.Config, model.Cycle, whoami); var Dto = mapper.Map <IEnumerable <AppraisalForApprovalViewDto> >(result); //THIS COULD BE FIXED LATER WITH MONGO QUERY //rearrange object Dto.ToList().ForEach(x => { x.Kra_Details.ToList().ForEach(y => { y.KeyResultArea.whoami = y.KeyResultArea.HeadOfDepartment.EmployeeId == employeeid ? "hod" : "appraiser"; }); }); return(Ok(Dto)); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> Check(int employeeid, string whoami) { try { var result = await appResult.GetEmployeesToAppraise(employeeid, "5e8efe5806468b0001c0fc9b", "5e8efe5806468b0001c0fc9b", whoami); var Dto = mapper.Map <IEnumerable <AppraisalForApprovalViewDto> >(result); return(Ok(Dto)); } catch (Exception ex) { throw ex; } }