Beispiel #1
0
        private TestLimitType Save(TestLimitTypeDto dto)
        {
            TestLimitType entity = null;

            try
            {
                if (dto.ID == 0)
                {
                    entity = new TestLimitType();
                    Mapper.Map(dto, entity);
                    _repository.Repository <TestLimitType>().Insert(entity);
                }
                else
                {
                    entity = GetById(dto.ID);
                    Mapper.Map(dto, entity);
                    _repository.Repository <TestLimitType>().Update(entity);
                }
                _repository.Save();
            }
            catch (DbEntityValidationException valEx)
            {
                HandleValidationException(valEx);
            }
            catch (Exception ex)
            {
                LogException(ex);
                throw;
            }

            return(entity);
        }
Beispiel #2
0
        public int Add(TestLimitTypeDto dto)
        {
            TestLimitType entity = Save(dto);

            if (entity != null)
            {
                return(entity.ID);
            }
            else
            {
                return(-1);
            }
        }
Beispiel #3
0
 private TestLimitTypeDto MapEntity(TestLimitType entity)
 {
     return(Mapper.Map <TestLimitType, TestLimitTypeDto>(entity));
 }