public IEnumerable <EmployeeDetails> GetAllEmployees() { try { _logger.LogInformation("GetAllEmployees was called"); return(_ctx.Employees .Include(e => e.Dependents) .Select(e => EmployeeHelper.ConverttoEmployeeDetail(e, _rules.Value)) .ToList()); } catch (Exception ex) { _logger.LogError($"Failed to get all Employee: {ex}"); return(null); } }
// used async call public EmployeeDetails Search(SearchCriteria query) { try { _logger.LogInformation("Search was called"); var result = _ctx.Employees .Include(emp => emp.Dependents) .FirstOrDefault(emp => emp.Id == query.Id); return(result == null ? null : EmployeeHelper.ConverttoEmployeeDetail(result, _rules.Value)); } catch (Exception ex) { _logger.LogError($"Failed to get particular Employee: {ex}"); return(null); } }