/// <summary> /// this method is used to fetch all designations of a department /// </summary> /// <param name="departmentId">integer to identity department</param> /// <returns>returns list of designation of that department</returns> public async Task <List <DesignationListDto> > GetAllDesignationAsync(int departmentId) { var designationIdsList = await _departmentDesignationRepository.GetAllDesignationsAsync(departmentId); if (designationIdsList.Count == 0) { return(null); throw new Exception("No designation department mapping found"); } var designationList = await _designationRepository.GetDesignation(designationIdsList); var designationListDto = new List <DesignationListDto>(); foreach (var d in designationList) { var designation = new DesignationListDto { Id = d.Id, Title = d.Title }; designationListDto.Add(designation); } return(designationListDto); }
/// <summary> /// this method is used to get the list of all designation /// </summary> /// <returns></returns> public async Task <List <DesignationListDto> > GetDesignationList() { var designations = await _designationRepository.GetDesignationList(); var designationList = new List <DesignationListDto>(); foreach (var d in designations) { var designation = new DesignationListDto { Id = d.Id, Title = d.Title }; designationList.Add(designation); } return(designationList); }