public void Put(int id, [FromBody] TestScriptVM scripts)
        {
            try
            {
                var mapVM = _mapper.Map <TestScript_MapVM>(scripts);

                var testScriptMapEntity = _mapper.Map <TestScripts_Map>(mapVM);
                testScriptMapEntity.MasterTestScriptID = id;

                var mappedData = _testScriptsRepo.GetMappedTestScript(id, scripts.UserId);

                if (mappedData != null)
                {
                    _testScriptsRepo.UpdateScriptMap(scripts.UserId, testScriptMapEntity);
                }
                else
                {
                    _testScriptsRepo.CreateScriptMap(testScriptMapEntity);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} ,  Message: {ex.Message}");
            }
        }
 public void UpdateScriptAdmin(int id, [FromBody] TestScriptVM scripts)
 {
     try
     {
         var data = _mapper.Map <TestScripts>(scripts);
         _testScriptsRepo.UpdateScript(id, data);
     }
     catch (Exception ex)
     {
         _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} ,  Message: {ex.Message}");
     }
 }
        public TestScriptVM GetScriptAdmin(int id)
        {
            var result = new TestScriptVM();

            try
            {
                result = _mapper.Map <TestScriptVM>(_genericRepo.GetById(id));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} ,  Message: {ex.Message}");
            }

            return(result);
        }
        public TestScriptVM Get(int id, int userId)
        {
            var result = new TestScriptVM();

            try
            {
                result = _mapper.Map <TestScriptVM>(_genericRepo.GetById(id));
                var mappedData = _mapper.Map <TestScript_MapVM>(_testScriptsRepo.GetMappedTestScript(id, userId));
                if (mappedData != null)
                {
                    result = _mapper.Map <TestScriptVM>(mappedData);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} ,  Message: {ex.Message}");
            }

            return(result);
        }