public void DeleteServiceGymTypeViewModel(int?id, ServiceGymTypeViewModel serviceGymTypeViewModel) { try { if (id == null) { throw new ArgumentNullException("El parametro id esta vacio"); } var serviceGymType = _serviceGymTypeRepository.GetServiceGymTypeById(id); if (serviceGymType == null) { throw new ArgumentNullException("La entidad no puede ser nula"); } _serviceGymTypeRepository.DeleteServiceGymType(id); //_logger.LogInformation("ServiceGymType Eliminado"); } #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 al eliminar el serviceGymType, message:" + e.Message); throw new Exception("Error de excepcion al eliminar el service"); } }
public void UpateServiceGymTypeViewModel(int?id, ServiceGymTypeViewModel serviceGymTypeViewModel) { try { if (id == null) { throw new Exception("El parametro id es un nulo"); } var serviceGymType = _serviceGymTypeRepository.GetServiceGymTypeById(id); if (serviceGymType == null) { //_logger.LogWarning("Error al traer el service Gym"); throw new Exception("Error en la obtencion del service Gym"); } _converterServiceGymTypeViewModelToServiceGymType.Map(serviceGymTypeViewModel, serviceGymType); _serviceGymTypeRepository.UpdateServiceGymType(serviceGymType); //_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 CreateServiceGymTypeViewModel(ServiceGymTypeViewModel serviceGymTypeViewModel) { try { if (serviceGymTypeViewModel != null) { var serviceGymType = _converterServiceGymTypeViewModelToServiceGymType.Map(serviceGymTypeViewModel); _serviceGymTypeRepository.CreateServiceGymType(serviceGymType); //_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); } }
private void CreateServiceGymType_Click(object sender, RoutedEventArgs e) { if (!InValidContext()) return; var serviceGymTypeViewModel = new ServiceGymTypeViewModel() { Type = Type.Text, }; try { _serviceGymTypeRepository.CreateServiceGymTypeViewModel(serviceGymTypeViewModel); CleanControls(); } catch (System.Exception) { throw; } }
private void EditServiceGymType_Click(object sender, RoutedEventArgs e) { if (!InValidContext()) { return; } var serviceGymTypeViewModel = new ServiceGymTypeViewModel() { Type = Type.Text, Id = int.Parse(Id.Text) }; try { _serviceGymTypeRepository.UpateServiceGymTypeViewModel(_serviceGymTypeId, serviceGymTypeViewModel); CleanControls(); } catch (System.Exception) { throw; } }