public void UpdateTestControllerAdmin(int id, [FromBody] TestControllerVM testController2) { try { var data = _mapper.Map <TestController>(testController2); _testControllerRepo.UpdateController2(id, data); } catch (Exception ex) { _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} , Message: {ex.Message}"); } }
public void AddTestControllerAdmin([FromBody] TestControllerVM controller2) { try { var data = _mapper.Map <TestController>(controller2); _testControllerRepo.CreateController2(data); } catch (Exception ex) { _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} , Message: {ex.Message}"); } }
public TestControllerVM GetTestControllerByIdAdmin(int id) { var result = new TestControllerVM(); try { var data = _genericRepo2.GetById(id); result = _mapper.Map <TestControllerVM>(data); } catch (Exception ex) { _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} , Message: {ex.Message}"); } return(result); }
public TestControllerVM GetController2ById(int id, int userId) { var result = new TestControllerVM(); try { var data = _genericRepo2.GetById(id); result = _mapper.Map <TestControllerVM>(data); var mappedData = _mapper.Map <TestController_MapVM>(_testControllerRepo.GetMappedTestControllerData(userId, data, id)); if (mappedData != null) { result = _mapper.Map <TestControllerVM>(mappedData); } } catch (Exception ex) { _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} , Message: {ex.Message}"); } return(result); }
public void UpdateTestController(int id, [FromBody] TestControllerVM testController2) { try { var data = _mapper.Map <TestController>(testController2); var mappedData = _testControllerRepo.GetMappedTestControllerData(testController2.UserId, data, id); if (mappedData != null) { var mappedUpdate = _mapper.Map <TestController_MapVM>(testController2); var mapData = _mapper.Map <TestController_Map>(mappedUpdate); mapData.RefId = id; _testControllerRepo.UpdateController2Map(testController2.UserId, mapData); } else { _testControllerRepo.CreateController2Map(testController2.UserId, data, id); } } catch (Exception ex) { _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} , Message: {ex.Message}"); } }