Beispiel #1
0
        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");
            }
        }
Beispiel #2
0
        public ServiceGymViewModel GetServiceGymByIdViewModel(int?id)
        {
            try
            {
                if (id == null)
                {
                    throw new ArgumentNullException("El parametro id esta vacio");
                }
                var serviceGym = _serviceGymRepository.GetServiceGymById(id);
                serviceGym.ServiceGymType = _serviceGymTypeRepository.GetServiceGymTypeById(serviceGym.ServiceGymTypeId);
                if (serviceGym == null)
                {
                    throw new ArgumentNullException("La entidad no puede ser nula");
                }

                return(_converterServiceGymToServiceGymViewModel.Map(serviceGym));
            }
            catch (Exception e)
            {
                //_logger.LogWarning("Error al devolver el serviceGym, message:" + e.Message);
                throw new Exception("Error al devolver el serviceGym, message:" + e.Message);
            }
        }