Example #1
0
        public void DeleteServiceGymViewModel(int?id, ServiceGymViewModel serviceGymViewModel)
        {
            try
            {
                if (id == null)
                {
                    throw new ArgumentNullException("El parametro id esta vacio");
                }
                var serviceGym = _serviceGymRepository.GetServiceGymById(id);
                if (serviceGym == null)
                {
                    throw new ArgumentNullException("La entidad no puede ser nula");
                }

                _serviceGymRepository.DeleteServiceGym(id);
                //_logger.LogInformation("ServiceGym 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 serviceGym, message:" + e.Message);
                throw new Exception("Error de excepcion al eliminar el service");
            }
        }
Example #2
0
        public void UpateServiceGymViewModel(int?id, ServiceGymViewModel serviceGymViewModel)
        {
            try
            {
                if (id == null)
                {
                    throw new Exception("El parametro id es un nulo");
                }
                var serviceGym = _serviceGymRepository.GetServiceGymById(id);
                if (serviceGym == null)
                {
                    _logger.LogWarning("Error al traer el service Gym");
                    throw new Exception("Error en la obtencion del service Gym");
                }

                _converterServiceGymViewModelToServiceGym.Map(serviceGymViewModel, serviceGym);
                _serviceGymRepository.UpdateServiceGym(serviceGym);
                //_logger.LogInformation("ServiceGym Actualizado");
            }
            catch (Exception e)
            {
                //_logger.LogWarning("exception al actualizar el cliente especifico");
                throw new Exception("Error al actualizar el cliente. message: " + e.Message);
            }
        }
Example #3
0
        public void CreateServiceGymViewModel(ServiceGymViewModel serviceGymViewModel)
        {
            try
            {
                if (serviceGymViewModel != null)
                {
                    var serviceGym = _converterServiceGymViewModelToServiceGym.Map(serviceGymViewModel);
                    _serviceGymRepository.CreateServiceGym(serviceGym);
                    //_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 CreateServiceGym_Click(object sender, RoutedEventArgs e)
        {
            if (!InValidContext())
            {
                return;
            }
            var serviceGymViewModel = new ServiceGymViewModel()
            {
                Name             = Name.Text,
                ServiceGymTypeId = int.Parse(ServiceGymTypeId.SelectedValue.ToString())
            };

            try
            {
                _serviceGymRepository.CreateServiceGymViewModel(serviceGymViewModel);
                CleanControls();
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Example #5
0
        public void EditServiceGym_Click(object sender, RoutedEventArgs e)
        {
            if (!InValidContext())
            {
                return;
            }
            var serviceGymViewModel = new ServiceGymViewModel()
            {
                Id               = int.Parse(Id.Text),
                Name             = Name.Text,
                ServiceGymTypeId = int.Parse(ServiceGymTypeId.SelectedValue.ToString()),
            };

            try
            {
                _serviceGymRepository.UpateServiceGymViewModel(_serviceGymsId, serviceGymViewModel);
                CleanControls();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }