/// <summary>
        ///
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public IResult GetDeclarationsByUserId(SearchSortModel search)
        {
            var healthViewModelList = new List <HealthTrackViewModel>();
            var result = new Result
            {
                Operation  = Operation.Read,
                Status     = Status.Success,
                StatusCode = HttpStatusCode.OK
            };

            try
            {
                var declarationList = _healthTrackRepository.GetDeclarationsByUserId(search);
                if (declarationList.Any())
                {
                    healthViewModelList = declarationList.Select(declaration =>
                    {
                        var healthViewModel = new HealthTrackViewModel();
                        healthViewModel.MapFromModel(declaration);
                        var employeeVm = new EmployeeViewModel();
                        employeeVm.MapFromModel(declaration.Employee);
                        healthViewModel.Employee = employeeVm;
                        return(healthViewModel);
                    }).ToList();

                    search.SearchResult = healthViewModelList;
                    result.Body         = search;
                }
                else
                {
                    result.Status     = Status.Fail;
                    result.StatusCode = HttpStatusCode.NotFound;
                    result.Message    = "No declaration exists";
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                result.Status     = Status.Error;
                result.Message    = ex.Message;
                result.StatusCode = HttpStatusCode.InternalServerError;
            }
            return(result);
        }
        /// <summary>
        ///  Returns data to export in excel
        /// </summary>
        /// <returns></returns>
        public IResult GetAllDeclarations(SearchSortModel search)
        {
            var healthViewModelList = new List <HealthTrackViewModel>();
            var result = new Result
            {
                Operation  = Operation.Read,
                Status     = Status.Success,
                StatusCode = HttpStatusCode.OK
            };

            try
            {
                var declarationList = _healthTrackRepository.GetAllDeclarations(search);
                if (declarationList.Any())
                {
                    healthViewModelList = declarationList.Select(declaration =>
                    {
                        var healthViewModel = new HealthTrackViewModel();
                        healthViewModel.MapFromModel(declaration);
                        var employeeVm = new EmployeeViewModel();
                        employeeVm.MapFromModel(declaration.Employee);
                        healthViewModel.Employee = employeeVm;
                        var symptoms             = new List <HealthTrackSymptomViewModel>();
                        var questions            = new List <HealthTrackQuestionAnswerViewModel>();
                        if (declaration.HealthTrackQuestions.Any())
                        {
                            questions = declaration.HealthTrackQuestions.Select(t =>
                            {
                                var questions = new HealthTrackQuestionAnswerViewModel();
                                questions.MapFromModel(t);
                                questions.Question = t.Question.Name;
                                return(questions);
                            }).ToList();
                        }

                        if (declaration.HealthTrackSymptoms.Any())
                        {
                            symptoms = declaration.HealthTrackSymptoms.Select(t =>
                            {
                                var symptom = new HealthTrackSymptomViewModel();
                                symptom.MapFromModel(t);
                                symptom.Name = t.Symptom.Name;
                                return(symptom);
                            }).ToList();
                        }
                        healthViewModel.HealthTrackSymptoms        = symptoms;
                        healthViewModel.HealthTrackQuestionAnswers = questions;
                        return(healthViewModel);
                    }).ToList();

                    result.Body = healthViewModelList;
                }
                else
                {
                    result.Status     = Status.Fail;
                    result.StatusCode = HttpStatusCode.NotFound;
                    result.Message    = "No declaration exists";
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                result.Status     = Status.Error;
                result.Message    = ex.Message;
                result.StatusCode = HttpStatusCode.InternalServerError;
            }
            return(result);
        }
        /// <summary>
        ///  Returns data to bind on declaration form
        /// </summary>
        /// <returns></returns>
        public async Task <IResult> GetSelfDeclarationByEmployeeForRequest(int employeedId, string requestNumber)
        {
            var healthViewModelList = new List <HealthTrackViewModel>();
            var result = new Result
            {
                Operation  = Operation.Read,
                Status     = Status.Success,
                StatusCode = HttpStatusCode.OK
            };

            try
            {
                var declarationList = await _healthTrackRepository.GetSelfDeclarationByEmployeeForRequest(employeedId, requestNumber);

                if (declarationList.Any())
                {
                    healthViewModelList = declarationList.Select(declaration =>
                    {
                        var healthViewModel = new HealthTrackViewModel();
                        healthViewModel.MapFromModel(declaration);
                        var employeeVm = new EmployeeViewModel();
                        employeeVm.MapFromModel(declaration.Employee);
                        healthViewModel.Employee = employeeVm;
                        var symptoms             = new List <HealthTrackSymptomViewModel>();
                        var questions            = new List <HealthTrackQuestionAnswerViewModel>();
                        if (declaration.HealthTrackQuestions.Any())
                        {
                            questions = declaration.HealthTrackQuestions.Select(t =>
                            {
                                var questions = new HealthTrackQuestionAnswerViewModel();
                                questions.MapFromModel(t);
                                return(questions);
                            }).ToList();
                        }

                        if (declaration.HealthTrackSymptoms.Any())
                        {
                            symptoms = declaration.HealthTrackSymptoms.Select(t =>
                            {
                                var symptom = new HealthTrackSymptomViewModel();
                                symptom.MapFromModel(t);
                                return(symptom);
                            }).ToList();
                        }
                        healthViewModel.HealthTrackSymptoms        = symptoms;
                        healthViewModel.HealthTrackQuestionAnswers = questions;
                        return(healthViewModel);
                    }).ToList();

                    result.Body = healthViewModelList;
                }
                else
                {
                    result.Status     = Status.Fail;
                    result.StatusCode = HttpStatusCode.NotFound;
                    result.Message    = "No declaration exists";
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                result.Status     = Status.Error;
                result.Message    = ex.Message;
                result.StatusCode = HttpStatusCode.InternalServerError;
            }
            return(result);
        }