public void UpateSessionGymView(int?id, SessionGymViewModel sessionGymViewModel) { try { if (id == null) { throw new Exception("El parametro id es un nulo"); } var sessionGym = _sessionGymRepository.GetSessionGymById(id); if (sessionGym == null) { //_logger.LogWarning("Error al traer el service Gym"); throw new Exception("Error en la obtencion del service Gym"); } _convertSessionGymViewModelToSessionGym.Map(sessionGymViewModel, sessionGym); _sessionGymRepository.UpdateSessionGym(id, sessionGym); //_logger.LogInformation("ServiceGymType Actualizado"); } catch (Exception e) { //_logger.LogWarning("exception al actualizar el cliente especifico"); throw new Exception("Error al actualizar el cliente. message: " + e.Message); } }
public void CreateSessionGym(SessionGymViewModel sessionGymViewModel) { try { if (sessionGymViewModel != null) { var sessionGym = _convertSessionGymViewModelToSessionGym.Map(sessionGymViewModel); _sessionGymRepository.CreateSessionGym(sessionGym); //_logger.LogInformation("Service Gym Created"); } } #pragma warning disable CS0168 // La variable 'e' se ha declarado pero nunca se usa catch (Exception e) #pragma warning restore CS0168 // La variable 'e' se ha declarado pero nunca se usa { //_logger.LogWarning("Error el modelo llega nulo, message: " + e.Message); } }