Beispiel #1
0
        public UnitConfiguration CreateUnitConfiguration(UnitConfigurationRequest UnitConfiguration)
        {
            var entityToInsert = new UnitConfiguration()
            {
            };

            MergeUnitConfiguration(entityToInsert, UnitConfiguration);
            UnitConfigurationRepository.Insert(entityToInsert);
            return(entityToInsert);
        }
Beispiel #2
0
        public UnitConfiguration GetById(int UnitConfigurationId)
        {
            var UnitConfiguration = UnitConfigurationRepository.GetById(UnitConfigurationId);

            if (UnitConfiguration == null)
            {
                throw new BadRequestException(ErrorMessages.GastoNoEncontrado);
            }

            return(UnitConfiguration);
        }
Beispiel #3
0
        public IList <UnitConfiguration> GetAll()
        {
            var UnitConfigurations = UnitConfigurationRepository.GetAll();

            if (UnitConfigurations == null)
            {
                throw new BadRequestException(ErrorMessages.GastoNoEncontrado);
            }

            var result     = new List <UnitConfiguration>();
            var enumerator = UnitConfigurations.GetEnumerator();

            while (enumerator.MoveNext())
            {
                result.Add(enumerator.Current);
            }
            return(result);
        }
Beispiel #4
0
 public IList <UnitConfiguration> GetByUnitId(int UnitId, DateTime startDate, DateTime endDate)
 {
     return(UnitConfigurationRepository.GetByUnitId(UnitId, startDate, endDate).ToList());
 }
Beispiel #5
0
        public void DeleteUnitConfiguration(int UnitConfigurationId)
        {
            var UnitConfiguration = UnitConfigurationRepository.GetById(UnitConfigurationId);

            UnitConfigurationRepository.Delete(UnitConfiguration);
        }
Beispiel #6
0
 public UnitConfiguration UpdateUnitConfiguration(UnitConfiguration originalUnitConfiguration, UnitConfigurationRequest UnitConfiguration)
 {
     this.MergeUnitConfiguration(originalUnitConfiguration, UnitConfiguration);
     UnitConfigurationRepository.Update(originalUnitConfiguration);
     return(originalUnitConfiguration);
 }